Qt4 & Visual Studio memory leak detection
I was trying to use Visual Studios's built in memory leak detection according to
http://msdn2.microsoft.com/en-us/lib...h3(VS.80).aspx
but when I compile my project I get errors in the Qt library:
help!?
Paul
Code:
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(332) : warning C4003: not enough actual parameters for macro 'realloc'
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(332) : error C2059: syntax error : ','
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(365) : warning C4003: not enough actual parameters for macro 'realloc'
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(365) : error C2059: syntax error : ','
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(379) : warning C4003: not enough actual parameters for macro 'realloc'
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(379) : error C2059: syntax error : ','
2>c:\devel\code\3rdparty\qt-4.3.3\src\corelib\tools\qbytearray.h(382) : warning C4003: not enough actual parameters for macro 'realloc'
Re: Qt4 & Visual Studio memory leak detection
Ah, figures, the MS header stuff has to be after all the Qt stuff. To bad it still doesn't work right.
Paul
Re: Qt4 & Visual Studio memory leak detection
I can recommend Visual Leak Detector for memory leak detection, works very well for me.
Re: Qt4 & Visual Studio memory leak detection
Huh, I just tried to use it and it couldn't catch any memory leaks at all. I even started putting in memory leaks on purpose, and each time it kept saying "No memory leaks detected."
You really use this? It doesn't seem to work worth a darn. For instance, this code should leak pretty badly.
Code:
#include "vld.h"
int main () {
char *pChar = new char[30];
pChar = 0;
int *pInt = new int;
return 0;
}
Yet the output on the visual studio says:
Visual Leak Detector Version 1.9f installed.
No memory leaks detected.
Visual Leak Detector is now exiting.
Doesn't seem to work at all.
Paul
Re: Qt4 & Visual Studio memory leak detection
What sucks is that using Visual Studio's method, it picks up the memory leaks just fine, but doesn't tell me where in the world they originated from!
Code:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
int main () {
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
char *pChar = new char[30];
pChar = 0;
int *pInt = new int;
return 0;
}
Quote:
Detected memory leaks!
Dumping objects ->
{61} normal block at 0x00335FD8, 4 bytes long.
Data: < > CD CD CD CD
{60} normal block at 0x00332A00, 30 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
The program '[1380] exceptions.exe: Native' has exited with code 0 (0x0).
Anyone know what I'm doing wrong here?
Paul