Can a 32-bit program use more than 4GB of memory on a 64-bit OS?
Is a 32-bit program running on a 64-bit OS able to use mo开发者_运维技巧re than 4GB of memory if available?
Short answer is: yes. Longer answer is depends. There is a hardware support for page re-mapping, which basically gives your program a window of a few pages into a larger area of memory. This window is however, should be managed by the program itself and will not get support from memory manager. There are examples of programs doing that like SQL on Windows. However, in general it is a bad idea and the program should either limit itself for 4GB or move to 64bits :)
Normally you're limited to a 2GB address space, in which all your allocations and their overhead, fragmentation, etc., must fit along with memory-mapped files (which includes your program and the DLLs it uses). This effectively limits you to 1.5GB.
With special configuration, e.g. /3GB, you can make more than 2GB available to applications, but by doing so you rob the kernel of space, costing you file caching, handle capacity, etc..
On Win32, you can use more with PAE support, but it's not transparent, you have to manage it yourself.
Only by explicitly mapping 4GB ranges of memory into its address space.
精彩评论