devalone
@devalone
̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻̻

Куда течёт память в Qt?

Valgrind выдаёт следующий лог:
spoiler

==11013== HEAP SUMMARY:
==11013== in use at exit: 925,638 bytes in 6,870 blocks
==11013== total heap usage: 161,998 allocs, 155,128 frees, 30,622,000 bytes allocated
==11013==
==11013== 48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 1,031 of 1,379
==11013== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0x59B3431: QAccessible::queryAccessibleInterface(QObject*) (in /opt/qt/5.9/gcc_64/lib/libQt5Gui.so.5.9.0)
==11013== by 0xD8458DE: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5XcbQpa.so.5.9.0)
==11013== by 0xD8510A3: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5XcbQpa.so.5.9.0)
==11013== by 0xDFE7816: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5DBus.so.5.9.0)
==11013== by 0xDFEA45D: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5DBus.so.5.9.0)
==11013== by 0x62FBEE0: QObject::event(QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x4F8D4BB: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Widgets.so.5.9.0)
==11013== by 0x4F948E6: QApplication::notify(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Widgets.so.5.9.0)
==11013== by 0x62D0E77: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D325A: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x6322532: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013==
==11013== 4,104 bytes in 1 blocks are possibly lost in loss record 1,356 of 1,379
==11013== at 0x4C2DB2F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0x19F0B796: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19EEAFD0: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19EECD56: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19F098D3: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19F4B586: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19F54EDE: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19ED4BB8: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x19ED5D62: ??? (in /opt/qt/5.9/gcc_64/plugins/sqldrivers/libqsqlite.so)
==11013== by 0x567D421: QSqlQuery::exec() (in /opt/qt/5.9/gcc_64/lib/libQt5Sql.so.5.9.0)
==11013== by 0x19143A: Course::sqlInsert() (course.cpp:141)
==11013== by 0x1A2FB3: Model::save() (model.cpp:24)
==11013==
==11013== 5,729 (4,352 direct, 1,377 indirect) bytes in 17 blocks are definitely lost in loss record 1,359 of 1,379
==11013== at 0x4C2DB2F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0xDAEE099: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013== by 0xDAEE7F1: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013== by 0xDAEFCAA: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013== by 0xDAF6001: ??? (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013== by 0xA610B3B: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.2)
==11013== by 0xA61145B: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.2)
==11013== by 0xA612D5D: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.2)
==11013== by 0xA613494: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.2)
==11013== by 0xA61578E: XML_ParseBuffer (in /lib/x86_64-linux-gnu/libexpat.so.1.6.2)
==11013== by 0xDAF444A: FcConfigParseAndLoad (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013== by 0xDAF4756: FcConfigParseAndLoad (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0)
==11013==
==11013== 6,629 (232 direct, 6,397 indirect) bytes in 1 blocks are definitely lost in loss record 1,360 of 1,379
==11013== at 0x4C2FB45: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0xEAD7B6F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE208E: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE2572: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAD5F29: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAC0831: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xDFD90C7: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5DBus.so.5.9.0)
==11013== by 0x62FBEE0: QObject::event(QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D0E62: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D325A: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x6322532: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0xA33E376: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5200.0)
==11013==
==11013== 6,719 (232 direct, 6,487 indirect) bytes in 1 blocks are definitely lost in loss record 1,361 of 1,379
==11013== at 0x4C2FB45: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0xEAD7B6F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE208E: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE24B9: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAD5F29: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAC0831: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEABC13B: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xDFD9291: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5DBus.so.5.9.0)
==11013== by 0x62FBEE0: QObject::event(QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D0E62: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D325A: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x6322532: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013==
==11013== LEAK SUMMARY:
==11013== definitely lost: 4,832 bytes in 20 blocks
==11013== indirectly lost: 14,293 bytes in 142 blocks
==11013== possibly lost: 4,104 bytes in 1 blocks

Если посмотреть вот этот кусок:

==11013== 6,719 (232 direct, 6,487 indirect) bytes in 1 blocks are definitely lost in loss record 1,361 of 1,379
==11013== at 0x4C2FB45: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11013== by 0xEAD7B6F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE208E: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAE24B9: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAD5F29: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEAC0831: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xEABC13B: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.7)
==11013== by 0xDFD9291: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5DBus.so.5.9.0)
==11013== by 0x62FBEE0: QObject::event(QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D0E62: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x62D325A: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)
==11013== by 0x6322532: ??? (in /opt/qt/5.9/gcc_64/lib/libQt5Core.so.5.9.0)

Valgrind уверен, что здесь утечка, но неужели она есть в тех либах, что он указал или всё таки проблема в моём коде?
Qt взят с официального сайта.
  • Вопрос задан
  • 346 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы