[Qt-interest] How to detect memory leaks

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Mon Jul 12 13:46:51 CEST 2010


Hi Santhosh, 
 
I use Visual Leak Detector - you then just add an include at the start of
your main: 
 
// Visual leak detector - must be first
// #include <vld.h>

#include <QtGui/QApplication>
 
int main(int argc, char *argv[])
{
...
}

It worked well in 2005 - I haven't used it much in 2008.  IIRC it gives you
a stack trace to the new of every undeleted object, or a list of items in
your output, and you double-click on them to show the source line. 
 
Tony.
 
 

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Santhosh Y
Sent: Monday, 12 July 2010 18:46
To: qt-interest at trolltech.com
Subject: [Qt-interest] How to detect memory leaks


Hi,

How to see memory leaks in my Qt application. Would like to know the amount
of memory leak in my application.

I am working on Windows OS,  using 


1. Microsoft Visual Studio 2008
    Version 9.0.21022.8 RTM
    Microsoft .NET Framework
    Version 3.5 SP1
2. Qt 4.5.2 version 



1. Any idea of how to run purify for a Qt application.
2. Any flags to be added to the project file / Visual studio for detecting
memory leaks?

Thanks in advance.

Regards,
Santhosh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100712/5b9dff68/attachment.html 


More information about the Qt-interest-old mailing list