[Qt-interest] How to detect memory leaks

Colin S. Miller no-spam-thank-you at csmiller.demon.co.uk
Tue Jul 13 21:48:58 CEST 2010


Santhosh Y wrote:
> 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?
> 
Santhosh,

There's always Fortify. Available here [1]
but its in .LHA format.

7-Zip [2] might be able to deal with it.

My last company used a heavily patched version of
Fortify, and we found it to be excellent.

However, it works by replacing malloc/realloc/free
by #define'ing wrappers around them, so you need
to #include fortify.h  in all your source files.

It does support C++. I'm not sure how the
C++ support works, as we'd removed the
support during our extensive extensions
to it, and thus we never used it on C++.


It does support mixing Fortifyied and non-Fortified code,
but you might be better building a Fortified version
of QT.

HTH,
Colin S. Miller

[1] http://aminet.net/package/dev/c/fortify22
[2] http://www.7-zip.org/




More information about the Qt-interest-old mailing list