Thought I would make a post here for anyone else that has not joined Discord…
There seems to be way to change a win32 binary to allow RAM access from the standard (and current) 2GB to the optimal 4GB for 32bit applications. This works by setting a flag on your binary header, literally just 4 bytes of data.
What this would mean is a bigger space to develop your apps, and in particular apps built for Windows that are pushing the 2GB boundaries. Your Simulator will no longer crash at around 1.7GB of RAM usage with this patch.
If you’re developing for mobile devices it doesn’t mean that you should make an app that uses that much resources, although the current 2GB limit can serve as a soft cap, it would be the same as developing your app on a Mac, which has Solar2D running as a 64bit application.
Here are the instructions using Microsoft Visual Studio on the command line. I use 2017 but can be done with any version (2010+), just make adjustments to find vcvarsall.bat
in your MSVS install path.
Before you start, make a backup/copy of the exe file you want to patch.
- Open command prompt
- Run this command to execute the batch file, don’t miss the x86 at end:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
- Run the following command changing path to the location of the exe you want to patch.
editbin /LARGEADDRESSAWARE "C:\Users\siu\Desktop\VRAM Test.exe"
- To verify the patch worked, run the following command, again change path to the file you just patched.
dumpbin /headers "C:\Users\siu\Desktop\VRAM Test.exe" | more
If successful, in the File Header Values you’ll see a line that says “Application can handle large (>2GB) addresses.
Here’s how the process looked when I patched a sample project:
This can be applied to Corona Simulator.exe
itself, as well as any Windows app you build with Solar2D.
I must put a disclaimer here because I definitely cannot guarantee that you’ll have no issues; this is a try at your own risk
.
I do have an app I will be running with this patch, if anything comes up I’ll report it here.
If you don’t have MSVS and don’t want to install it, you can use this tool which does the same thing. I did a file analysis and the tool does exactly what the instructions above do.
I also made a project providing patched and original exe builds that you can run and test on your machine. There’s a readme file inside that probably should be read.
VRAM Test.Win32.7z (3.0 MB)