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

QScxmlCompiler memleaks when compiling certains state machines

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6, dev
    • XML: SCXML
    • None

    Description

      This can be observed on some of the tests in the qtscxml submodule, but I also created a standalone reproducer.

      Running the attached example shows something like this:

      Indirect leak of 48 byte(s) in 1 object(s) allocated from:
          #0 0x7f82edebf91f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x7f82e5487d12 in allocateData /home/ivan/qt5/qtbase/src/corelib/tools/qarraydata.cpp:139
          #2 0x7f82e54880b5 in TestQtNamespace::QArrayData::allocate(TestQtNamespace::QArrayData**, long long, long long, long long, TestQtNamespace::QArrayData::AllocationOption) /home/ivan/qt5/qtbase/src/corelib/tools/qarraydata.cpp:189
          #3 0x7f82e53df2ee in TestQtNamespace::QTypedArrayData<char16_t>::allocate(long long, TestQtNamespace::QArrayData::AllocationOption) (/home/ivan/qt6-build/debug/qtbase/lib/libQt6Core.so.6+0x7df2ee)
          #4 0x7f82e53954b0 in TestQtNamespace::QString::QString(TestQtNamespace::QChar const*, long long) /home/ivan/qt5/qtbase/src/corelib/text/qstring.cpp:2494
          #5 0x7f82e84aeb56 in TestQtNamespace::QStringView::toString() const (/home/ivan/qt6-build/debug/qtbase/lib/libQt6Scxml.so.6+0xaeb56)
          #6 0x7f82e849c66f in TestQtNamespace::QScxmlCompilerPrivate::preReadElementSend() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:1793
          #7 0x7f82e84a5028 in TestQtNamespace::QScxmlCompilerPrivate::readElement() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2200
          #8 0x7f82e84a593c in TestQtNamespace::QScxmlCompilerPrivate::readElement() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2221
          #9 0x7f82e84a593c in TestQtNamespace::QScxmlCompilerPrivate::readElement() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2221
          #10 0x7f82e84a593c in TestQtNamespace::QScxmlCompilerPrivate::readElement() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2221
          #11 0x7f82e84a593c in TestQtNamespace::QScxmlCompilerPrivate::readElement() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2221
          #12 0x7f82e84a3998 in TestQtNamespace::QScxmlCompilerPrivate::readDocument() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:2115
          #13 0x7f82e8484b6f in TestQtNamespace::QScxmlCompiler::compile() /home/ivan/qt5/qtscxml/src/scxml/qscxmlcompiler.cpp:777
          #14 0x7f82e8548f77 in TestQtNamespace::QScxmlStateMachine::fromData(TestQtNamespace::QIODevice*, TestQtNamespace::QString const&) /home/ivan/qt5/qtscxml/src/scxml/qscxmlstatemachine.cpp:1421
          #15 0x7f82eddae98c in TestQtNamespace::QScxmlStateMachineLoader::parse(TestQtNamespace::QUrl const&) /home/ivan/qt5/qtscxml/src/scxmlqml/statemachineloader.cpp:175
          #16 0x7f82eddac932 in TestQtNamespace::QScxmlStateMachineLoader::setSource(TestQtNamespace::QUrl const&) /home/ivan/qt5/qtscxml/src/scxmlqml/statemachineloader.cpp:75
          #17 0x7f82edd769f4 in TestQtNamespace::QScxmlStateMachineLoader::qt_static_metacall(TestQtNamespace::QObject*, TestQtNamespace::QMetaObject::Call, int, void**) /home/ivan/qt6-build/debug/qtscxml/src/scxmlqml/ScxmlQml_autogen/EWIEGA46WW/moc_statemachineloader_p.cpp:197
          #18 0x7f82edd771a7 in TestQtNamespace::QScxmlStateMachineLoader::qt_metacall(TestQtNamespace::QMetaObject::Call, int, void**) /home/ivan/qt6-build/debug/qtscxml/src/scxmlqml/ScxmlQml_autogen/EWIEGA46WW/moc_statemachineloader_p.cpp:246
          #19 0x7f82e7476801 in void TestQtNamespace::QQmlPropertyData::doMetacall<(TestQtNamespace::QMetaObject::Call)2>(TestQtNamespace::QObject*, int, void**) const /home/ivan/qt6-build/debug/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../../../qt5/qtdeclarative/src/qml/qml/qqmlpropertydata_p.h:329
          #20 0x7f82e74756bb in TestQtNamespace::QQmlPropertyData::writeProperty(TestQtNamespace::QObject*, void*, TestQtNamespace::QFlags<TestQtNamespace::QQmlPropertyData::WriteFlag>) const /home/ivan/qt6-build/debug/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../../../qt5/qtdeclarative/src/qml/qml/qqmlpropertydata_p.h:347
          #21 0x7f82e7471a87 in operator() /home/ivan/qt5/qtdeclarative/src/qml/qml/qqml.cpp:1106
          #22 0x7f82e7473fad in changeObjectProperty<false, TestQtNamespace::QQmlPrivate::storeObjectProperty<>(TestQtNamespace::QV4::Lookup*, TestQtNamespace::QObject*, void*)::<lambda(const TestQtNamespace::QQmlPropertyData*)> > /home/ivan/qt5/qtdeclarative/src/qml/qml/qqml.cpp:1090
          #23 0x7f82e7471bce in storeObjectProperty<> /home/ivan/qt5/qtdeclarative/src/qml/qml/qqml.cpp:1105
          #24 0x7f82e7470137 in TestQtNamespace::QQmlPrivate::AOTCompiledContext::setObjectLookup(unsigned int, TestQtNamespace::QObject*, void*) const /home/ivan/qt5/qtdeclarative/src/qml/qml/qqml.cpp:2199
          #25 0x5566187eb5e5 in QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::aotBuiltFunctions::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, TestQtNamespace::QQmlPrivate::AOTCompiledContext const**)#1}::operator()(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, void*)#1}::operator()(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, void*) const /home/ivan/Projects/build-QScxmlCompilerMemleak-Qt_dev-Debug/.rcc/qmlcache/appQScxmlCompilerMemleak_Main_qml.cpp:260
          #26 0x5566187eba7d in void QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::wrapCall<QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::aotBuiltFunctions::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, TestQtNamespace::QQmlPrivate::AOTCompiledContext const**)#1}::operator()(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, void*)#1}>(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::aotBuiltFunctions::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, TestQtNamespace::QQmlPrivate::AOTCompiledContext const**)#1}::operator()(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, void*)#1}&&) /home/ivan/Projects/build-QScxmlCompilerMemleak-Qt_dev-Debug/.rcc/qmlcache/appQScxmlCompilerMemleak_Main_qml.cpp:225
          #27 0x5566187eb7db in QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::aotBuiltFunctions::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, TestQtNamespace::QQmlPrivate::AOTCompiledContext const**)#1}::operator()(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*) const /home/ivan/Projects/build-QScxmlCompilerMemleak-Qt_dev-Debug/.rcc/qmlcache/appQScxmlCompilerMemleak_Main_qml.cpp:238
          #28 0x5566187eb862 in QmlCacheGeneratedCode::_0x5f_QScxmlCompilerMemleak_Main_qml::aotBuiltFunctions::{lambda(TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*, TestQtNamespace::QQmlPrivate::AOTCompiledContext const**)#1}::_FUN(TestQtNamespace::QQmlPrivate::AOTCompiledContext const, TestQtNamespace::QQmlPrivate::AOTCompiledContext const*, void*) /home/ivan/Projects/build-QScxmlCompilerMemleak-Qt_dev-Debug/.rcc/qmlcache/appQScxmlCompilerMemleak_Main_qml.cpp:271
          #29 0x7f82e738759f in TestQtNamespace::QV4::Moth::VME::exec(TestQtNamespace::QV4::MetaTypesStackFrame*, TestQtNamespace::QV4::ExecutionEngine*) /home/ivan/qt5/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:503
      

      The full ASAN log is in the attachment, as well as the standalone project.

      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
              ivan.solovev Ivan Solovev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes