I have a class like this (assume all malloc's succeedes)
class CMyClass
{
public:
CMyClass()
{
lpData = malloc(128);
};
~CMyClass()
{
free(lpData);
};
public:
LPVOID lpData;
};
then I execute this:
CMyClass *lpList = new CMyClass[32768];
delete [] lpList;
The problem is that in x86 the code works fine and fast (some milliseconds to complete in debug and release builds) but in x64 the delete call takes about 15 seconds to free all memory.
O.S. is Win7 x64.
Hints will be appreciated.
Regards, Mauro.
It is possible that if you are running your test app through a debugger that you are hitting some performance issue with the Windows debug heap. Add _NO_DEBUG_HEAP=1
to the environment settings for the debuggee (in the Project Properties->Configuration Properties->Debugging->Environment property under Visual Studio 20xx) and see if that improves your deallocation perf.