Memory max of 32 bit apps in 64 bit OS

kingduh

Distinguished
Dec 8, 2009
6
0
18,510
Hi there, does anyone know if you use a 32 bit application under windows XP 64 bit edition will that app be able to utilize more then 4 gigs of ram -OR- does the app have to be written for 64bit in order to utilize the additional ram?
 

lok

Distinguished
Oct 29, 2009
95
0
18,660
2 to the power of 32 is 4GB, so there's no straightforward way of addressing more than 4GB in a 32bit application. In days past, people used strange techniques such as something called memory paging to extend the address space, but that's fallen by the wayside as it comes with a substantial performance hit. In other words: no, only 64bit apps can address more than 4GB.
 
The good news is that a 32-bit program CAN access more memory under a 64-bit OS than under a 32-bit OS. Under the latter, a 32-bit program can only access a maximum of 3GB of memory, but with a 64-bit OS it can access up to a full 4GB. Both of these assume that the application is flagged as being "large address aware".

Some programs such as SQL Server are capable of accessing more than 4GB of RAM under a 32-bit Server version of the OS, but they use a special "AWE" (Address Windowing Extensions") API to do so. No desktop programs that I'm aware of can do this - not even clever programs such as Photoshop.

For full details, see: http://msdn.microsoft.com/en-us/library/aa366778%28VS.85%29.aspx
 

jedimasterben

Distinguished
Sep 22, 2007
1,172
1
19,360

I thought that under 32-bit, a program could access 2GB, and LAA would enable it to have 3GB..
 

mikrev007

Distinguished
Oct 28, 2008
264
0
18,790


Under 32bit Windows it is 3GB because the kernel needs to be there. In 64bit there is no kernel present in the address space for a 32bit application, so it can grow to 4GB.
 
By default, Windows32 (assuming the full 4GB is used) reserves 2GB for the kernal, and 2GB for the user. Hence, all applications must total less then 2GB of RAM usage. (EG: Crysis on my old rig always maxed at ~1.7GB, and combined with other apps, was right at the 2GB limit). The 3GB switch can change this behavior to allow the application RAM limit to be moved up to 3GB.

PAE allows for a larger total address space (via multiple address tables), but no single app can access more then the total space of a single address table (4GB). So you gain the ability to use more then 4GB (up to 64GB), but no single app can use more then 4GB at one time.

Windows64 allows up to 2^64 (a lot :D) or RAM, which is shared equally for all user programs. Some amount is still reserved for the Kernal though (I suspect 2GB, but have not confirmed this...)
 

mikrev007

Distinguished
Oct 28, 2008
264
0
18,790


The total is only limited by the amount of memory you have (physical ram + page file). Each application gets 2GB to play with.



The virtual address space right now in 64bit Windows (for a 64bit app) is 16TB. 8TB of that is reserved for the kernel. And the individual address space also applies here. Each app gets 8TB.