Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2009-09

A problem of Memory leak checking with valgrind

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

shuang han

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.freepascal.org/pipermail/qt/attachments/20090921/f037c010/attachment.html>

Reply by email