Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82395

Small memory leak

    XMLWordPrintable

Details

    • 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c

    Description

      After patches that fix QTBUG-82000 (reproducible with example in that bug), there is still a small leak. I am not sure if that existed before:

      With https://codereview.qt-project.org/c/qt/qtdeclarative/+/291070 only, there are few leaks:

      8 bytes in 1 blocks are definitely lost in loss record 9 of 264
        in operator new[](unsigned long) in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:431
        1: operator new[](unsigned long) in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:431
        2: QLinkedStringHash<QPair<int, QQmlPropertyData*> >::linkAndReserve(QLinkedStringHash<QPair<int, QQmlPropertyData*> > const&, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qlinkedstringhash_p.h:82
        3: QQmlPropertyCache::copy(int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:261
        4: QQmlPropertyCache::copy() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:271
        5: QQmlMetaTypeData::propertyCache(QQmlType const&, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlmetatypedata.cpp:165
        6: QQmlMetaType::propertyCache(QQmlType const&, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlmetatype.cpp:1208
        7: QQmlEnginePrivate::cache(QQmlType const&, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlengine_p.h:386
        8: QQmlTypeData::buildTypeResolutionCaches(QQmlRefPointer<QQmlTypeNameCache>*, QV4::ResolvedTypeReferenceMap*) const in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypedata.cpp:766
        9: QQmlTypeData::done() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypedata.cpp:302
        10: QQmlDataBlob::tryDone() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmldatablob.cpp:518
        11: QQmlTypeLoader::setData(QQmlDataBlob*, QQmlDataBlob::SourceCodeData const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:443
        12: QQmlTypeLoader::setData(QQmlDataBlob*, QString const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:424
        13: QQmlTypeLoader::loadThread(QQmlDataBlob*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:296
        14: QQmlTypeLoaderThread::loadThread(QQmlDataBlob*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloaderthread.cpp:156
        15: void QQmlThread::callMethodInThread<QQmlDataBlob*, QQmlDataBlob*, QQmlTypeLoaderThread>(void (QQmlTypeLoaderThread::*)(QQmlDataBlob*), QQmlDataBlob* const&)::I::call(QQmlThread*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread_p.h:164
        16: QQmlThreadPrivate::threadEvent() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:204
        17: QQmlThreadPrivate::event(QEvent*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:142
        18: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/widgets/kernel/qapplication.cpp:3684
        19: QApplication::notify(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/widgets/kernel/qapplication.cpp:3024
        20: QCoreApplication::notifyInternal2(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qcoreapplication.cpp:1092
        21: QCoreApplication::sendEvent(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qcoreapplication.cpp:1487
        22: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qcoreapplication.cpp:1832
        23: QCoreApplication::sendPostedEvents(QObject*, int) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qcoreapplication.cpp:1691
        24: postEventSourceDispatch(_GSource*, int (*)(void*), void*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:277
        25: g_main_context_dispatch in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2
        26: /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2
        27: g_main_context_iteration in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2
        28: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:425
        29: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qeventloop.cpp:138
        30: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qeventloop.cpp:225
        31: QThread::exec() in /home/jopoikel/work/qt/git/qtbase/src/corelib/thread/qthread.cpp:536
        32: QQmlThreadPrivate::run() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:155
        33: QThreadPrivate::start(void*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/thread/qthread_unix.cpp:342
        34: start_thread in /build/glibc-LK5gWL/glibc-2.23/nptl/pthread_create.c:333
        35: clone in /build/glibc-LK5gWL/glibc-2.23/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      
      32 bytes in 1 blocks are possibly lost in loss record 54 of 264
        in main in /home/jopoikel/qtbug82000/main.cpp:35
        1: operator new(unsigned long) in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:342
        2: QRecyclePool<QQmlJavaScriptExpressionGuard, 1024>::QRecyclePool() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qrecyclepool_p.h:118
        3: QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlengine.cpp:683
        4: QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate(QQmlEngine*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:51
        5: QQmlApplicationEngine::QQmlApplicationEngine(QObject*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:211
        6: main in /home/jopoikel/qtbug82000/main.cpp:35
      
      57,360 bytes in 1 blocks are possibly lost in loss record 263 of 264
        in main in /home/jopoikel/qtbug82000/main.cpp:36
        1: malloc in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:307
        2: QRecyclePoolPrivate<QQmlJavaScriptExpressionGuard, 1024>::allocate() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qrecyclepool_p.h:189
        3: QQmlJavaScriptExpressionGuard* QRecyclePool<QQmlJavaScriptExpressionGuard, 1024>::New<QQmlJavaScriptExpression*>(QQmlJavaScriptExpression*&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qrecyclepool_p.h:150
        4: QQmlJavaScriptExpressionGuard::New(QQmlJavaScriptExpression*, QQmlEngine*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmljavascriptexpression_p.h:277
        5: QQmlPropertyCapture::captureProperty(QObject*, int, int, bool) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:313
        6: QV4::QObjectWrapper::getProperty(QV4::ExecutionEngine*, QObject*, QQmlPropertyData*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:261
        7: QV4::QObjectWrapper::getQmlProperty(QV4::ExecutionEngine*, QQmlContextData*, QObject*, QV4::String*, QV4::QObjectWrapper::RevisionMode, bool*, QQmlPropertyData**) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:388
        8: QV4::QQmlContextWrapper::getPropertyAndBase(QV4::QQmlContextWrapper const*, QV4::PropertyKey, QV4::Value const*, bool*, QV4::Value*, QV4::Lookup*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4qmlcontext.cpp:285
        9: QV4::QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(QV4::Lookup*, QV4::ExecutionEngine*, QV4::Value*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4qmlcontext.cpp:481
        10: QV4::Moth::VME::interpret(QV4::CppStackFrame*, QV4::ExecutionEngine*, char const*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:585
        11: QV4::Moth::VME::exec(QV4::CppStackFrame*, QV4::ExecutionEngine*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:463
        12: QV4::Function::call(QV4::Value const*, QV4::Value const*, int, QV4::ExecutionContext const*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/jsruntime/qv4function.cpp:69
        13: QQmlJavaScriptExpression::evaluate(QV4::CallData*, bool*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:211
        14: QQmlBinding::evaluate(bool*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlbinding.cpp:210
        15: QQmlNonbindingBinding::doUpdate(QQmlJavaScriptExpression::DeleteWatcher const&, QFlags<QQmlPropertyData::WriteFlag>, QV4::Scope&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlbinding.cpp:246
        16: QQmlBinding::update(QFlags<QQmlPropertyData::WriteFlag>) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlbinding.cpp:186
        17: QQmlBinding::setEnabled(bool, QFlags<QQmlPropertyData::WriteFlag>) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlbinding.cpp:553
        18: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlobjectcreator.cpp:1391
        19: QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:969
        20: QQmlComponentPrivate::completeCreate() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:1005
        21: QQmlComponent::completeCreate() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:997
        22: QQmlComponent::create(QQmlContext*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:811
        23: QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:134
        24: QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:118
        25: QQmlApplicationEngine::load(QUrl const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:264
        26: main in /home/jopoikel/qtbug82000/main.cpp:36
      

      After applying both patches, there is still one (this is also there with the other patch applied):

      40 bytes in 1 blocks are definitely lost in loss record 34 of 165
        in qRegisterResourceData(int, unsigned char const*, unsigned char const*, unsigned char const*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/io/qresource.cpp:967
        1: operator new(unsigned long) in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:342
        2: qRegisterResourceData(int, unsigned char const*, unsigned char const*, unsigned char const*) in /home/jopoikel/work/qt/git/qtbase/src/corelib/io/qresource.cpp:967
        3: (anonymous namespace)::Registry::Registry() in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:588
        4: (anonymous namespace)::(anonymous namespace)::Q_QGS_unitRegistry::innerFunction()::Holder::Holder() in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:525
        5: (anonymous namespace)::(anonymous namespace)::Q_QGS_unitRegistry::innerFunction() in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:525
        6: QGlobalStatic<(anonymous namespace)::Registry, (anonymous namespace)::(anonymous namespace)::Q_QGS_unitRegistry::innerFunction(), (anonymous namespace)::(anonymous namespace)::Q_QGS_unitRegistry::guard>::operator()() in /home/jopoikel/work/qt/git/qtbase/src/corelib/global/qglobalstatic.h:136
        7: qInitResources_qmake_QtQuick_Controls_2() in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:607
        8: (anonymous namespace)::qInitResources_qmake_QtQuick_Controls_2_ctor_class_::qInitResources_qmake_QtQuick_Controls_2_ctor_class_() in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:610
        9: __static_initialization_and_destruction_0(int, int) in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:610
        10: _GLOBAL__sub_I_qmlcache_loader.cpp in /home/jopoikel/work/qt/5.14/qtquickcontrols2/src/imports/controls/.qmlcache/qmlcache_loader.cpp:613
        11: call_init.part.0 in /build/glibc-LK5gWL/glibc-2.23/elf/dl-init.c:72
        12: call_init in /build/glibc-LK5gWL/glibc-2.23/elf/dl-init.c:30
        13: _dl_init in /build/glibc-LK5gWL/glibc-2.23/elf/dl-init.c:120
        14: dl_open_worker in /build/glibc-LK5gWL/glibc-2.23/elf/dl-open.c:575
        15: _dl_catch_error in /build/glibc-LK5gWL/glibc-2.23/elf/dl-error.c:187
        16: _dl_open in /build/glibc-LK5gWL/glibc-2.23/elf/dl-open.c:660
        17: dlopen_doit in /build/glibc-LK5gWL/glibc-2.23/dlfcn/dlopen.c:66
        18: _dl_catch_error in /build/glibc-LK5gWL/glibc-2.23/elf/dl-error.c:187
        19: _dlerror_run in /build/glibc-LK5gWL/glibc-2.23/dlfcn/dlerror.c:163
        20: dlopen@@GLIBC_2.2.5 in /build/glibc-LK5gWL/glibc-2.23/dlfcn/dlopen.c:87
        21: QLibraryPrivate::load_sys() in /home/jopoikel/work/qt/git/qtbase/src/corelib/plugin/qlibrary_unix.cpp:235
        22: QLibraryPrivate::load() in /home/jopoikel/work/qt/git/qtbase/src/corelib/plugin/qlibrary.cpp:553
        23: QLibraryPrivate::loadPlugin() in /home/jopoikel/work/qt/git/qtbase/src/corelib/plugin/qlibrary.cpp:608
        24: QPluginLoader::load() in /home/jopoikel/work/qt/git/qtbase/src/corelib/plugin/qpluginloader.cpp:240
        25: QQmlImportDatabase::importDynamicPlugin(QString const&, QString const&, QString const&, int, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlimport.cpp:2098
        26: QQmlImportsPrivate::importExtension(QString const&, QString const&, int, int, QQmlImportDatabase*, QQmlTypeLoaderQmldirContent const&, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlimport.cpp:1089
        27: QQmlImportsPrivate::addLibraryImport(QString const&, QString const&, int, int, QString const&, QString const&, bool, QQmlImportDatabase*, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlimport.cpp:1432
        28: QQmlImports::addLibraryImport(QQmlImportDatabase*, QString const&, QString const&, int, int, QString const&, QString const&, bool, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlimport.cpp:1675
        29: QQmlTypeLoader::Blob::addImport(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport>, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:575
        30: QQmlTypeLoader::Blob::addImport(QV4::CompiledData::Import const*, QList<QQmlError>*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:547
        31: QQmlTypeData::tryLoadFromDiskCache() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypedata.cpp:169
        32: QQmlTypeData::dataReceived(QQmlDataBlob::SourceCodeData const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypedata.cpp:435
        33: QQmlTypeLoader::setData(QQmlDataBlob*, QQmlDataBlob::SourceCodeData const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:433
        34: QQmlTypeLoader::setData(QQmlDataBlob*, QString const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:424
        35: QQmlTypeLoader::loadThread(QQmlDataBlob*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:296
        36: QQmlTypeLoaderThread::loadThread(QQmlDataBlob*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmltypeloaderthread.cpp:156
        37: void QQmlThread::callMethodInThread<QQmlDataBlob*, QQmlDataBlob*, QQmlTypeLoaderThread>(void (QQmlTypeLoaderThread::*)(QQmlDataBlob*), QQmlDataBlob* const&)::I::call(QQmlThread*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread_p.h:164
        38: QQmlThreadPrivate::threadEvent() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:204
        39: QQmlThreadPrivate::event(QEvent*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:142
        40: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/widgets/kernel/qapplication.cpp:3684
        41: QApplication::notify(QObject*, QEvent*) in /home/jopoikel/work/qt/git/qtbase/src/widgets/kernel/qapplication.cpp:3024
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              poikelin Joni Poikelin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes