ShadowDragon
ShadowDragon

Reputation: 2398

Allocate more RAM without re-compiling

I've got an old application for 32-bit Windows XP which is only able to allocate 2GB of RAM on my 64bit Windows 10 system. As this application tries to use more than 2GB RAM when storing a lot of data, I'm getting an Out of Memory Exception like this one:

Out of memory 8 addresses: (unknown)(0): Worldbuilder.exe+825384 (unknown) (unknown)(0): Worldbuilder.exe+798965 (unknown) (unknown)(0): Worldbuilder.exe+793330 (unknown) (unknown)(0): Worldbuilder.exe+793277 (unknown) (unknown)(0): Worldbuilder.exe+799637 (unknown) (unknown)(0): Worldbuilder.exe+666356 (unknown) (unknown)(0): Worldbuilder.exe+664774 (unknown) (unknown)(0): Worldbuilder.exe+723505 (unknown) Because of the severity of this error the game will now exit.

Note: The source code of the application is not available.

I also saw some tools which fix this problem by allowing the application to allocate up to 4GB of RAM without having to re-compile the application, like Large Address Aware.

My question is now: How are those tools able to achieve this.

Note: I'm using Windows 10 64bit with the programming languages C++/C. I also do not have any code yet as I do not even know how this works in theory.

Upvotes: 1

Views: 209

Answers (1)

Khouri Giordano
Khouri Giordano

Reputation: 796

It sets the large-address-aware flag in the executable's Win32PE header. This is normally set at link time. The application may not actually be able to handle a memory allocation greater than 2G if it uses signed 32-bit values to index into those allocations.

Upvotes: 1

Related Questions