How to Resolve an x86 Application that is Failing to Run Properly But Runs Successfully as x64

Modified on Wed, Jan 8 at 3:44 PM

I have app that must be x86. However, when I run this app it successfully executes a random amount of Threaded processes instead of the required 1000 processes.


When this same program is executed as x64 it works without issue (all 1000 threads execute).


By default, it seems like 32-bit applications have a memory limitation of around 1.2 - 2GB instead of using the full 4GB it has available. The 32bit version is invoking memory limitations on the program, which is causing the exception to be thrown and the application to hang. 


Follow these instructions to add post-build event commands to the application to resolve this issue:

  1. Open the C# Project Properties.
  2. Select the 'Build Events' tab on the left-hand side.
  3. Scroll down to the 'Post-build event command line'.
  4. Add the following commands ((you may need to adjust the path to your vcvars32.bat).
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"

editbin /largeaddressaware "$(TargetPath)"

        5. Save your changes (Ctrl+S) or just run the application.


Applying the above changes should enable your application to use all of the allotted memory!

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article