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

Holding QObject* from a model in delegate leaks memory with TableView

    XMLWordPrintable

Details

    • 83fdcbf3be0ddbbee1fd2c8c9ff1a4e3c707e3f0 46162c304195db2376706f2e1a9da2b2c938e97b 0b2c04215dcdb0f209c46abe24c63deaaffc471c
    • Shovelling Snow

    Description

      Attached example leaks some memory. This seems to only happen when TableView is used:

      1,256 bytes in 1 blocks are possibly lost in loss record 296 of 331
        in main in /home/jopoikel/qtbug82000/main.cpp:36
        1: operator new[](unsigned long) in /home/jopoikel/work/valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:431
        2: QStringHash<QPair<int, QQmlPropertyData*> >::reserve(int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/ftw/qstringhash_p.h:760
        3: QQmlPropertyCache::update(QMetaObject const*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:706
        4: QQmlPropertyCache::QQmlPropertyCache(QMetaObject const*, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:219
        5: VDMAbstractItemModelDataType::initializeMetaType(QQmlAdaptorModel&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qmlmodels/qqmladaptormodel.cpp:545
        6: VDMAbstractItemModelDataType::createItem(QQmlAdaptorModel&, QQmlDelegateModelItemMetaType*, int, int, int) const in /home/jopoikel/work/qt/git/qtdeclarative/src/qmlmodels/qqmladaptormodel.cpp:515
        7: QQmlAdaptorModel::createItem(QQmlDelegateModelItemMetaType*, int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qmlmodels/qqmladaptormodel_p.h:144
        8: QQmlTableInstanceModel::resolveModelItem(int) in /home/jopoikel/work/qt/git/qtdeclarative/src/qmlmodels/qqmltableinstancemodel.cpp:152
        9: QQmlTableInstanceModel::object(int, QQmlIncubator::IncubationMode) in /home/jopoikel/work/qt/git/qtdeclarative/src/qmlmodels/qqmltableinstancemodel.cpp:169
        10: QQuickTableViewPrivate::createFxTableItem(QPoint const&, QQmlIncubator::IncubationMode) in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:994
        11: QQuickTableViewPrivate::loadFxTableItem(QPoint const&, QQmlIncubator::IncubationMode) in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:1052
        12: QQuickTableViewPrivate::processLoadRequest() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:1570
        13: QQuickTableViewPrivate::beginRebuildTable() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:1862
        14: QQuickTableViewPrivate::processRebuildTable() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:1621
        15: QQuickTableViewPrivate::updateTable() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:2101
        16: QQuickTableViewPrivate::updateTableRecursive() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:2056
        17: QQuickTableViewPrivate::updatePolish() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:2043
        18: QQuickTableViewPrivate::_q_componentFinalized() in /home/jopoikel/work/qt/git/qtdeclarative/src/quick/items/qquicktableview.cpp:2879
        19: QQuickTableView::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in /home/jopoikel/work/qt/5.14/qtdeclarative/src/quick/.moc/moc_qquicktableview_p.cpp:223
        20: QQuickTableView::qt_metacall(QMetaObject::Call, int, void**) in /home/jopoikel/work/qt/5.14/qtdeclarative/src/quick/.moc/moc_qquicktableview_p.cpp:393
        21: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) in /home/jopoikel/work/qt/git/qtbase/src/corelib/kernel/qmetaobject.cpp:316
        22: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlobjectcreator.cpp:1423
        23: QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:969
        24: QQmlComponentPrivate::completeCreate() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:1005
        25: QQmlComponent::completeCreate() in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:997
        26: QQmlComponent::create(QQmlContext*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:811
        27: QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:134
        28: QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:118
        29: QQmlApplicationEngine::load(QUrl const&) in /home/jopoikel/work/qt/git/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:264
        30: main in /home/jopoikel/qtbug82000/main.cpp:36
      
      57,360 bytes in 1 blocks are possibly lost in loss record 330 of 331
        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
      

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              poikelin Joni Poikelin
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes