Allow 32-bit windows builds to access 4GB using --large-address-aware cmake linker flag

• Aug 9, 2015 - 16:57
Type
Functional
Severity
S5 - Suggestion
Status
closed
Project

If try to load two very large (a little over 1GB) Salamander Grand Piano .sfz soundfonts using the mscore 2.0.2 release in 64-bit Windows 8.1, a CRASH occurs partyway though loading the second soundfont. I am almost certain this is because the memory usage exceeds the 2GB limit of 32-bit programs. However, 32-bit programs running in 64-bit windows can access 4GB of space if linked with --large-address-aware flag. After inserting the following flag in CMakeLists.txt, I am able to load both .sfz soundfonts without crashing musescore:

set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware")

I don't see any drawbacks, and I'm not aware of plans to actually release 64-bit windows builds, so I'll go ahead and submit a pull request.


Comments

There are benefits when running on 32-bit windows as well: If running in a 32-bit windows that has the "4GB tuning option" (4GT) enabled, then the 32-bit build linked the --large-address-aware will be able to access 3GB, instead of 2GB, according to https://msdn.microsoft.com/en-us/library/aa366778%28v=vs.85%29.aspx

According to https://msdn.microsoft.com/en-us/library/bb613473%28v=vs.85%29.aspx "Setting this flag and then running the application on a system that does not have 4GT support should not affect the application", so there should not be any negative effects of setting this flag. I don't have a 32-bit windows machine with low memory to test on, though I could test inside a 32-bit virtual machine with low memory.

I apologize if I am too hasty in creating a pull request without asking for approval, but I wanted to submit while it was on my mind and while I could test building it on my windows machine. I wouldn't be upset if you reject this PR.

For reference, ABL is building an unsupported 64 bits. The addressable memory is one thing, but apparently we also have users with 64bit driver for their midi keyboard... and they need the 64bit build to make it work.

Status (old) patch (code needs review) fixed

Fixed in branch master, commit 1c48b4c571

Fix #72731 win32 large-address-aware

This allows 32-bit builds to access 4GB memory when run in 64-bit windows.

This fixes issue that occurred when loading multiple large soundfonts would cause a crash in windows when exceed the 2GB limit. I'm able to build release both via command line makefile and in QT Creator, and tested them both to ensure now I'm able to load two very large zerberus .sfz soundfonts without crashing.