Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Large Address Aware flag work for 32 bit applications on 64-bit computers?

I've been reading that 32bit Windows applications are limited to 2 GB RAM because the upper 2GB of addressing space is reserved for the Windows OS (and, iirc, VRAM). If you use the /3GB flag on 32-bit WinXp you might get up to 3 GB of RAM available for addressing, but usually you have to tweak with userva values. I've heard that on 64 bit editions of Windows, with a large address aware flag in the PE header and over 4 GB of RAM, it is possible for an application to use all 4 GB of addressing space for its own memory management.

On the other hand, I'm pretty sure that when you call the windows API, you have to call memory locations within the 32-bit address space you're provided. So, exactly how much RAM can a 32-bit large address aware application use for itself in a 64-bit environment, really? And why?

Thank you.

like image 827
The Roll Avatar asked Mar 03 '11 19:03

The Roll


People also ask

What does large address aware do?

Large Address Aware (LAA) is a technique available in 64-bit Windows operating systems to allow 32-bit programs use all 4Gb (typically 2Gb user + 2Gb system space) of its potential memory space, rather than be limited by the default (typically 2Gb, but sometimes 3Gb if using special techniques).

How much memory can a 32-bit application address?

The 2 GB limit refers to a physical memory barrier for a process running on a 32-bit operating system, which can only use a maximum of 2 GB of memory.


1 Answers

The virtual address space is extended to 4GB. If you don't use the Address Windowing Extension API, the maximum amount of memory you can access is 4GB. Some of that space will be taken up by the OS for .dlls and other such things, but it will be possible for you to get memory back that uses all 32-bits of a pointer.

Incidentally, if you aren't large address aware, all memory pointers will not be negative when cast to a INT_PTR. This is actually a source of more than a few subtle bugs when using the large address aware flag, as pointers are treated signed values.

like image 153
MSN Avatar answered Sep 27 '22 16:09

MSN