Search code examples
c++visual-studio-2008memory-leaksqt4

On closing a Qt 4.5 application, Visual Studio reports that it has detected memory leaks


I am building a Qt 4.5 application on Windows using Visual Studio 2008. Whenever I run my application in Debug mode and then close it, Visual Studio prints the following to the output pane:

Detected memory leaks!
Dumping objects ->
{696512} normal block at 0x01981AB0, 24 bytes long.
Data: < > 00 CD CD CD 00 00 00 00 00 00 00 00 00 00 00 00
{696511} normal block at 0x02E59B70, 12 bytes long.
Data: < U2g U2g> B0 1A 98 01 E8 55 32 67 E8 55 32 67

And the output reports hundreds of such blocks. I have noticed this particularly when using Qt 4's Model/View framework. Does Qt in fact have memory leaks, or are there circumstances under which Visual Studio misreports leaks?


Solution

  • I had a chance to profile my project using DevPartner. The surprising thing is that it reports memory leaks in QtGuid4.dll and QtCored4.dll; however, after manually looking at each case, I discovered that they were all false positives.

    As a side note, there were no memory leaks reported in the code using Qt.