How to make 32-bit programs break the 2G memory limit

How to make 32-bit programs break the 2G memory limit

Under normal circumstances, the memory size of 32-bit programs is limited to 2G, but you can break through this limitation through the following operations.

Modify operating system parameters

This step is only for 32-bit operating systems, 64-bit operating systems can be skipped

  1. Open a command line window with administrator privileges

  2. carried out bcdedit.exe/set pae forceenable

Allow the system to recognize memory larger than 4G

  1. carried out bcdedit.exe/set increaseuserva 3072

Increase the size of household memory from the original 2G to 3G

  1. Restart the computer

Modify 32-bit program properties (headers)

  1. Open a command line window with administrator privileges

  2. carried out editbin.exe/largeaddressaware <your_application>.exe

In this way, this modified 32-bit program can use more than 2G of system memory.


note:

  1. editbin.exe Generally located in the installation directory of Visual Studio, for example, in the directory of Visual Studio 2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\editbin.exe

  2. Implementation of End editbin.exeafter, and then use the best dumpbin.exeto verify whether the changes to take effect

a. Command line execution: dumpbin.exe/headers <your_application>.exe | more

b. In the output of the program, if you can see it Application can handle large (>2GB) addresses, the modification has taken effect

  1. Although the total amount of memory that can be used after the program is modified exceeds 2G, the size limit for each memory application is still 2G, so if the program tries to apply for more than 2G of memory at one time, it will still fail, but generally there will not be a 32-bit The program will apply for such a large amount of memory at one time.

reference: