Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIN32 memory issue (differences between debug/release)

Tags:

c++

c

winapi

I'm currently working on a legacy app (win32, Visual C++ 2005) that allocates memory using LocalAlloc (in a supplied library I can't change). The app keeps very large state in fixed memory (created at the start with multiple calls to LocalAlloc( LPTR, size)). I notice that in release mode I run out of memory at about 1.8gb but in debug it happily goes on to over 3.8gb. I'm running XP64 with the /3gb switch. I need to increase the memory used in the app and I'm hitting the memory limit in release (debug works ok). Any ideas?

like image 947
Tim Ring Avatar asked Sep 22 '26 14:09

Tim Ring


1 Answers

You probably have the Debug configuration linking with /LARGEADDRESSAWARE and the Release configuration linking with /LARGEADDRESSAWARE:NO (or missing altogether).

Check Linker->System->Enable Large Addresses in the project's configuration properties.

like image 165
comshak Avatar answered Sep 24 '26 04:09

comshak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!