[Qt] A problem of Memory leak checking with valgrind
shuang han
hshbupt at gmail.com
Mon Sep 21 10:46:42 CEST 2009
Hi,
I have a problem about Memory leak checking, When a class is inherited from
a QT class, its memory leak cannot be checked by some tools, such as
valgrind, LeakTracer, and cppcheck.
Here is the code:
file <a.h>
#ifndef A_H
#define A_H
#include <qwidget.h>
#include <qpixmap.h>
class A: public QWidget
{
public:
A();
~A();
private:
int *p;
};
#endif
file<a.cpp>
#include"a.h"
A::A()
:QWidget()
{
p = new int[10];
}
A::~A()
{
}
file<main.cpp>
#include<iostream>
#Include"a.h"
int main()
{
A a;
return 0;
}
Then I run qmake -project; qmake; make.
Use valgrind, cppcheck and LeakTracer, they all can't trace the memory leak,
So I wondered is there any operation done by QT with regard to this?
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20090921/f037c010/attachment-0002.html>
More information about the Qt
mailing list