Why does QApplication cause memory leaks?

I have a simple code:

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    return 0;
}

I will compile it in Qt Creator using the pro file:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = testLeaks
TEMPLATE = app


SOURCES += main.cpp

HEADERS  +=

FORMS    +=

The team valgrind ./testLeakstalks about leaks and prints the following:

==31276== HEAP SUMMARY:
==31276==     in use at exit: 1,190,544 bytes in 7,267 blocks
==31276==   total heap usage: 46,096 allocs, 38,829 frees, 6,716,079 bytes allocated
==31276== 
==31276== LEAK SUMMARY:
==31276==    definitely lost: 2,788 bytes in 11 blocks
==31276==    indirectly lost: 7,065 bytes in 182 blocks
==31276==      possibly lost: 318,238 bytes in 1,233 blocks
==31276==    still reachable: 862,453 bytes in 5,841 blocks
==31276==         suppressed: 0 bytes in 0 blocks

If I comment on QApplication, there are no leaks. Why is this class leaking?

+4
source share
1 answer

As noted in the comments, the following command provides additional information:

valgrind --leak-check=full --show-leak-kinds=all -v ./testLeaks

You also cut the end of the short exit:

==3005== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2).

In any case, it is very likely that this is not a bug in QApplication, but some kind of main dependency, especially you mentioned that this will happen after the update libc.

libc , , , .

, , .

, 320K + Qt- ( GUI) , .

+1

All Articles