How to increase the 2GB memory limit of a 32-bit (x86) EXE in 64-bit (x64) Windows

How to block File Sharing for one or more IP Addresses in Windows

If you’re reading this, you are most likely dealing with an issue regarding a 64-bit Windows machine (such as Windows 2008 Server, Windows 2012 Server, Windows 7, Windows 10 and so on) and a rather old, 32-bit (x86) executable file with some memory issues.

If you already did some research, you might also be already aware of the fact that any single 32-bit application can use a maximum amount of 2GB of RAM, regardless of what your system actually has. This basically means that you cannot fix your issue with an hardware upgrade.

This leaves you with two alternatives, both software-based:

  • Get the x64 build of that application, or – in case you developed it first-hand – build it for 64-bit machines.
  • Patch the x86 executable files so it can use more RAM.

The former approach is definitely the way to go, assuming you can do that: however, if you stumbled upon this post, there’s a high chance that this is not the case. The executable is old and discontinued, you lost the source code or something like that. If that’s the case, the only viable option is to patch it.

You can do that using the great (and freeware4GB Patch tool developed by Daniel Pistelli, which can be used to modify any 32-bit executable, allowing it to address up to 4GB of RAM – as long as you have a 64-bit Operating System, otherwise it won’t work.

In case you’re wondering why things are this way on x64 system, here’s a brief explanation. On x86 systems, all applications are given 2GB of virtual memory out of the maximum 4GB available for the 32-bit architecture: the other 2 GB are reserved for the operating system itself. On x64 systems these additional 2 GB can be accessed by any 32bit application, as long as a specific flag is set in the file’s internal format. The patch tool does just that… and it actually works!

To use the tool, do the following:

How to increase the 2GB memory limit of a 32-bit (x86) EXE in 64-bit (x64) Windows

If you did everything properly, your EXE file should now be able to make use of up to 4GB of RAM.

That’s it for now: happy patching!

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.