WIN32 memory issue (differences between debug / release)

I am currently working on an old application (win32, Visual C ++ 2005) that allocates memory using LocalAlloc (in the supplied library I cannot change). The application saves a very large state in fixed memory (created at the beginning with several LocalAlloc calls (LPTR, size)). I notice that in release mode I run out of memory by about 1.8 GB, but in the debug version it gives more than 3.8 GB of pleasure. I am running XP64 with the / 3gb switch. I need to increase the memory used in the application, and I click on the memory limit in the release (debug is working fine). Any ideas?

+3
source share
3 answers

You probably have a Debug configuration associated with / LARGEADDRESSAWARE and a Release configuration associated with / LARGEADDRESSAWARE: NO (or none at all).

Check Linker-> System-> Enable large addresses in the project configuration properties.

+4
source

It looks like your release build is also compiling as x86. If not, there should be something in your code that treats the pointer as signed 32-bit integers, and this code is only active in Release.

How is running from memory manifested?

In addition, it makes no sense to use the / 3gb flag for XP64 when working with 64-bit applications: it does not change anything in this scenario

+1
source

: DLL, , , . , DLL , , LocalAlloc() , . ( , DLL, 0x40000000 (1Gb), 0x80000000 (2Gb), 0xC0000000 (3Gb). DLL , , 1 , , ).

, .

0
source

Source: https://habr.com/ru/post/1709759/


All Articles