Virtual address space in 64 bit systems running in compatibility mode
-
20-08-2019 - |
Question
I saw that on a 64 bit windows OS the user virtual address space available is 8 terra bytes. But if the program we are executing on this is running in 32 bit compatibility mode is this much of user space still available ? or does it behave like a normal 32 bit OS and gives only 2GB user address space?
Solution
Microsoft has a chart showing the various limits: Memory Limits for Windows Releases
To summarize just the user-mode virtual address space:
- 32-bit Windows:
- 32-bit process: 2 GB by default; 3 GB with
/LARGEADDRESSAWARE:YES
and 4GT
- 32-bit process: 2 GB by default; 3 GB with
- 64-bit Windows (x64 architecture):
- 32-bit process: 2 GB by default; 4 GB with
/LARGEADDRESSAWARE:YES
- 64-bit process: 8 TB by default; 2 GB with
/LARGEADDRESSAWARE:NO
- 32-bit process: 2 GB by default; 4 GB with
4GT is 4-gigabyte tuning:
- XP:
/3GB
boot.ini switch - Vista:
bcdedit /set increaseuserva 3072
Mark Russinovich made a blog post explaining many these limits: Pushing the Limits of Windows: Virtual Memory
OTHER TIPS
Your process will only see a 4GB virtual address space when it is running as a 32 bit process. It will not be able to addresses anything higher.
My original answer was pretty bad. Here is a link that explains what JaredPar was saying pretty well.
As far as the hardware is concerned, when you're running in compatibility mode (i.e. IA32_EFER.LMA is set and the L bit is clear in CS's segment descriptor) the segments behave like 32-bit segments. That is:
- the segment base is limited to 32 bits.
- the segment limit is limited to 32 bits as well (using the G bit).
This effectively limits you to 4GB of virtual addresses. I'm not familiar with how the OS partitions virtual memory in the various modes, but this is the hardware limit. (sorry... I'm a hardware guy, not an OS expert)
If your program is running as a 32 bit process on the Wow64 subsystem, it will see the exact same address space that it would see on an actual 32 bit OS. With no special options, a 32 bit process will have 2GB of memory available.
The only difference is the avaliable memory if you use the LargeAddressAware option. In a normal 32 bit process this allows for 3GB of addressable memory. In a Wow64 process it can see up to 4GB (Source)
It should be noted that running a 32-bit process on IIS 6.0+ with a 64-bit machine/OS, a process can address up to 4GB of memory.