Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
-
None
-
Tested with Fedora 28 in VM, Qt built using GCC 7.3.0
Description
With a simple test application (qt3dwindow.cc) that constructs Qt3DWindow, optionally calls window.show(), and then calls QApplication::quit() after 10 seconds, I see several memory leaks.
Stacktraces below are with 5.12.3, running either "./qt3dwindow" or "./qt3dwindow show" under "valgrind --leak-check=full". Qt built with GCC 7.3.0 in release mode, running on Fedora 28 in VM.
(1) Without calling Qt3DWindow::show():
==20042== 376 (16 direct, 360 indirect) bytes in 1 blocks are definitely lost in loss record 1,243 of 1,281 ==20042== at 0x4C2F4B6: operator new(unsigned long) (vg_replace_malloc.c:344) ==20042== by 0x407E3E6: Qt3DExtras::Qt3DWindowPrivate::Qt3DWindowPrivate() (qt3dwindow.cpp:86) ==20042== by 0x407E462: Qt3DExtras::Qt3DWindow::Qt3DWindow(QScreen*) (qt3dwindow.cpp:94) ==20042== by 0x4012A5: main (qt3dwindow.cc:17)
I think this may be m_inputSettings and/or m_root which don't seem to be freed anywhere (if show() not called), at least with a quick look.
(2) A second one without show():
==20042== 12,792 (32 direct, 12,760 indirect) bytes in 1 blocks are definitely lost in loss record 1,279 of 1,281 ==20042== at 0x4C2EE3B: malloc (vg_replace_malloc.c:309) ==20042== by 0x6067151: QListData::detach_grow(int*, int) (qlist.cpp:79) ==20042== by 0x622ADCD: detach_helper_grow (qlist.h:759) ==20042== by 0x622ADCD: QList<QObject*>::append(QObject* const&) (qlist.h:585) ==20042== by 0x6229249: QObjectPrivate::setParent_helper(QObject*) (qobject.cpp:2049) ==20042== by 0x41A88F3: Qt3DCore::QNodePrivate::_q_setParentHelper(Qt3DCore::QNode*) (qnode.cpp:322) ==20042== by 0x41A8B82: Qt3DCore::QNode::setParent(Qt3DCore::QNode*) (qnode.cpp:876) ==20042== by 0x407E571: Qt3DExtras::Qt3DWindow::Qt3DWindow(QScreen*) (qt3dwindow.cpp:126) ==20042== by 0x4012A5: main (qt3dwindow.cc:17)
I guess this may be caused by (1) if the QNode is not freed.
(3) Both with and without show():
==20042== 1,264 (88 direct, 1,176 indirect) bytes in 1 blocks are definitely lost in loss record 1,258 of 1,281 ==20042== at 0x4C2F4B6: operator new(unsigned long) (vg_replace_malloc.c:344) ==20042== by 0x6222470: queued_activate (qobject.cpp:3637) ==20042== by 0x6222470: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3744) ==20042== by 0x41B807F: Qt3DCore::QDownloadHelperServicePrivate::shutdown() (qdownloadhelperservice.cpp:117) ==20042== by 0x41B80CA: Qt3DCore::QDownloadHelperService::~QDownloadHelperService() (qdownloadhelperservice.cpp:141) ==20042== by 0x41B6395: ~QServiceLocatorPrivate (qservicelocator.cpp:88) ==20042== by 0x41B6395: cleanup (qscopedpointer.h:60) ==20042== by 0x41B6395: ~QScopedPointer (qscopedpointer.h:107) ==20042== by 0x41B6395: Qt3DCore::QServiceLocator::~QServiceLocator() (qservicelocator.cpp:139) ==20042== by 0x419F9BB: cleanup (qscopedpointer.h:60) ==20042== by 0x419F9BB: ~QScopedPointer (qscopedpointer.h:107) ==20042== by 0x419F9BB: Qt3DCore::QAspectManager::~QAspectManager() (qaspectmanager.cpp:94) ==20042== by 0x419FBC8: Qt3DCore::QAspectManager::~QAspectManager() (qaspectmanager.cpp:99) ==20042== by 0x41A109F: Qt3DCore::QAspectThread::run() (qaspectthread.cpp:92) ==20042== by 0x600A1CE: QThreadPrivate::start(void*) (qthread_unix.cpp:361) ==20042== by 0x67DF593: start_thread (pthread_create.c:463) ==20042== by 0x700DF4E: clone (clone.S:95) ==20042==
Looks like something in the teardown code, did not look further.
(4) Only if show() was called:
==20068== 24 bytes in 1 blocks are definitely lost in loss record 28 of 1,144 ==20068== at 0x4C2F4B6: operator new(unsigned long) (vg_replace_malloc.c:344) ==20068== by 0x567489F: Qt3DRender::Render::GraphicsContext::resolveHighestOpenGLFunctions() (graphicscontext.cpp:374) ==20068== by 0x5675D37: Qt3DRender::Render::GraphicsContext::initializeHelpers(QSurface*) (graphicscontext.cpp:214) ==20068== by 0x5675ECA: Qt3DRender::Render::GraphicsContext::makeCurrent(QSurface*) (graphicscontext.cpp:203) ==20068== by 0x569A36C: Qt3DRender::Render::SubmissionContext::beginDrawing(QSurface*) (submissioncontext.cpp:427) ==20068== by 0x564CD78: Qt3DRender::Render::Renderer::doRender(bool) (renderer.cpp:687) ==20068== by 0x5644132: Qt3DRender::Render::Renderer::render() (renderer.cpp:613) ==20068== by 0x552A1EC: Qt3DRender::Render::RenderThread::run() (renderthread.cpp:84) ==20068== by 0x600A1CE: QThreadPrivate::start(void*) (qthread_unix.cpp:361) ==20068== by 0x67DF593: start_thread (pthread_create.c:463) ==20068== by 0x700DF4E: clone (clone.S:95)
Looks like GraphicsHelperInterface is never freed.
At least (1) and (2) seem real bugs within Qt3DWindow, not 100% sure about (3) and (4).