Despite the fact that I am running a 64-bit version of Windows 7, I sometimes need to run 32-bit applications.  By default these applications are only able to use 2 GB of memory, regardless of the amount of available memory on the system (see: https://docs.microsoft.com/en-us/windows/win32/memory/memory-limits-for-windows-releases ).  However, I sometimes need these 32-bit applications to be able to use more than 2 GB of memory.  If upgrading to a 64-bit application is not an option, then I can still use up to 4 GB of memory by modifying the header of the application’s binary by using the following procedure (http://gisgeek.blogspot.com/2012/01/set-32bit-executable-largeaddressaware.html).  These steps were tested on a system with Visual Studio 2010 installed:

  1. Before performing any other step you should create a backup copy of the executable to be modified, especially if you cannot easily re-create or re-obtain the original.
  2. Launch a Visual Studio command prompt and execute the following command to modify the header of the application’s binary: editbin /LARGEADDRESSAWARE “C:pathtoexeexecutable.exe”.
  3. Verify that this worked by typing a command to print the binary’s header: dumpbin /headers “C:pathtoexeexecutable.exe” | more.  You should see “Application can handle large (>2GB) addresses” in the output.

After performing these steps the modified application should be able to use 4 GB of memory.  You should test the application to make sure that it still works correctly.  Ideally these tests will force the application to use more than 2 GB of memory.

If you are developing an application with Visual Studio you can modify the project properties in order to avoid modifying the binary in a post-processing step.  To make your application large address aware you should open the properties for your project and navigate to the “Linker -> System” page. On this page you should set the “Enable large addresses” property to “Yes (/LARGEADDRESSAWARE)”.

If you are running 64-bit Windows and have the option to upgrade a 32-bit application to 64-bit, I recommend upgrading the application instead of modifying its binary, as the consequences of doing so may be difficult to predict.  See the following thread for a discussion of potential problems with increasing the amount of memory available to 32-bit Python: http://bugs.python.org/issue1449496.  Even if the change does not result in any adverse effects, you will still need to switch to 64-bit when the application’s memory needs exceed 4 GB.  You should consider your application’s future memory needs when deciding how to increase memory in the short term.

Leave a comment

Your email address will not be published. Required fields are marked *

X