Is a 32-bit program running on a 64-bit OS able to use more than 4GB of memory if available?
-
It also depends on the machine/processor and the OS.– Romain HippeauMay 6, 2011 at 21:06
-
possible duplicate of Application cannot access more than 4 GB on 64 bit processor– OMG PoniesMay 6, 2011 at 21:11
-
This link may be useful: stackoverflow.com/questions/5916959/…– HasanMay 18, 2017 at 12:31
-
That links goes back to this thread... Anyway, the "only" limitation a 32-bit program has is that it cannot map more than 4GB at once. But you can easily extend it through shared memory.– mirhJan 27, 2020 at 22:33
3 Answers
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.