On 08.10.2015 22:09, Thiago Macieira wrote: > On Thursday 08 October 2015 21:57:09 Igor Mironchik wrote: >> Hi guys, >> >> Can anybody explain me, please. Is here memory leaks or no? >> >> Please look in the attachment... > Yes, these look like real leaks: > > ==3533== 136 (16 direct, 120 indirect) bytes in 1 blocks are definitely lost > in > loss record 396 of 514 > ==3533== at 0x4C2C100: operator new(unsigned long) (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==3533== by 0x5EDF731: QQmlFileSelectorPrivate::QQmlFileSelectorPrivate() > (in /home/igor/Qt/5.5/gcc_64/lib/libQt5Qml.so.5.5.0) > ==3533== by 0x5EDF949: QQmlFileSelector::QQmlFileSelector(QQmlEngine*, > QObject*) (in /home/igor/Qt/5.5/gcc_64/lib/libQt5Qml.so.5.5.0) > ==3533== by 0x5ED8C26: QQmlApplicationEnginePrivate::init() (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Qml.so.5.5.0) > ==3533== by 0x40272C: Application::Application(int, char**) > (application.cpp:15) > ==3533== by 0x402658: main (main.cpp:11) > > ==3533== 152 (112 direct, 40 indirect) bytes in 1 blocks are definitely lost > in > loss record 400 of 514 > ==3533== at 0x4C2C100: operator new(unsigned long) (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==3533== by 0x650EF21: QObject::QObject(QObject*) (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Core.so.5.5.0) > ==3533== by 0x4F74A73: ??? (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > ==3533== by 0x4F8340C: QSGRenderContext::initialize(QOpenGLContext*) (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > > ==3533== 224 (72 direct, 152 indirect) bytes in 1 blocks are definitely lost > in > loss record 414 of 514 > ==3533== at 0x4C2C100: operator new(unsigned long) (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==3533== by 0x4F7536B: ??? (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > ==3533== by 0x4F8364B: QSGRenderContext::createTexture(QImage const&) const > (in /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > ==3533== by 0x4F2DF5B: ??? (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > ==3533== by 0x4F8554B: > QSGRenderContext::textureForFactory(QQuickTextureFactory*, QQuickWindow*) (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Quick.so.5.5.0) > > The backtrace of the first one goes all the way back to your Application > constructor (which is missing the & for argc!!), so the leak might be in your > code, not in Qt.
I look, look and look at this code, but I can't understand where leak can be... Application::Application(int & argc, char *argv[]) : QGuiApplication(argc, argv) { m_engine = new QQmlApplicationEngine(this); auto context = m_engine->rootContext(); context->setContextProperty("appDir", applicationDirPath()); context->setContextProperty("App", this); m_engine->load(QUrl("qrc:/MainWindow.qml")); QObject *root = m_engine->rootObjects().at(0); if(!root) { qDebug() << "FAILED TO LOAD ROOT OBJECT"; ::exit(ROOT_NOT_FOUND); } m_updateTimer = startTimer(1000); } > > I'm assuming that all ??? that your log shows are not Qt frames and not of > Qt's fault. In most cases, I'm probably right. There are some that I'd like > more information on, like: > > ==3533== 42 bytes in 1 blocks are definitely lost in loss record 212 of 514 > ==3533== at 0x4C2BBA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck- > amd64-linux.so) > ==3533== by 0x142E5F6E: ??? > ==3533== by 0x142C9314: ??? > ==3533== by 0xEA7D163: ??? > ==3533== by 0xEA7D518: ??? > ==3533== by 0xDCBAF59: ??? > ==3533== by 0xDCB1D11: ??? > ==3533== by 0xDC3D0DD: ??? > ==3533== by 0x54D46D6: QAccessible::setRootObject(QObject*) (in > /home/igor/Qt/5.5/gcc_64/lib/libQt5Gui.so.5.5.0) > > Please recompile in debug mode and set the XCB plugin to no-unload (add to the > linker flags: -Wl,-z,nodelete). -- Best Regards, Igor Mironchik. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest