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

Memory leaks in qv8contextwrapper.cpp and qv8bindings.cpp when adding QML items with PropertyChanges elements

    XMLWordPrintable

Details

    Description

      Attached MemLeaksMain.qml has a button "Add Square". Pressing it adds a rectangle which changes the state to "readwrite" on Component.onCompleted. The state "readwrite" changes the color of the rectangle. Both the original and new new color are defined in Colors.js.

      Every time a rectangle is added you get two memory leaks from qv8contextwrapper.cpp line 175 and one from qv8bindings.cpp line 276.

      Here is the Call Stack of the qv8contextwrapper.cpp memory leak:

      > QtQmld5.dll!QV8ContextWrapper::qmlScope(QQmlContextData * ctxt=0x01e7eb78, QObject * scope=0x01e7eee0) Line 188 C++
      QtQmld5.dll!QV8Engine::qmlScope(QQmlContextData * ctxt=0x01e7eb78, QObject * scope=0x01e7eee0) Line 557 + 0x17 bytes C++
      QtQmld5.dll!QQmlJavaScriptExpression::evalFunction(QQmlContextData * ctxt=0x01e7eb78, QObject * scope=0x01e7eee0, const QString & code="(function onCompleted() {

      { state = "readwrite" }

      })", const QString & filename="", unsigned short line=44, v8::Persistent<v8::Object> * qmlscope=0x01e7f8d4) Line 399 C++
      QtQmld5.dll!QQmlBoundSignalExpression::evaluate(void * * a=0x00000000) Line 223 + 0x4a bytes C++
      QtQmld5.dll!QQmlBoundSignal_callback(QQmlNotifierEndpoint * e=0x01e7f774, void * * a=0x00000000) Line 398 C++
      QtQmld5.dll!QQmlNotifier::emitNotify(QQmlNotifierEndpoint * endpoint=0x01e7f774, void * * a=0x00000000) Line 95 + 0x1d bytes C++
      QtQmld5.dll!QQmlData::signalEmitted(QAbstractDeclarativeData * __formal=0x01e7f7d0, QObject * object=0x01e7f568, int index=3, void * * a=0x00000000) Line 590 + 0x13 bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01e7f568, int signalOffset=3, int local_signal_index=0, void * * argv=0x00000000) Line 3333 + 0x1e bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01e7f568, const QMetaObject * m=0x5e6cfb34, int local_signal_index=0, void * * argv=0x00000000) Line 3315 + 0x1e bytes C++
      QtQmld5.dll!QQmlComponentAttached::completed() Line 131 + 0x13 bytes C++
      QtQmld5.dll!QQmlVME::complete(const QQmlVME::Interrupt & interrupt=

      {...}) Line 1352 C++
      QtQmld5.dll!QQmlIncubatorPrivate::incubate(QQmlVME::Interrupt & i={...}

      ) Line 329 + 0xf bytes C++
      QtQmld5.dll!QQmlEnginePrivate::incubate(QQmlIncubator & i=

      {...}, QQmlContextData * forContext=0x01e7e298) Line 97 C++
      QtQmld5.dll!QQmlComponent::create(QQmlIncubator & incubator={...}

      , QQmlContext * context=0x01e7e070, QQmlContext * forContext=0x00000000) Line 1073 C++
      QtQuickd5.dll!QQuickLoaderPrivate::_q_sourceLoaded() Line 731 C++
      QtQuickd5.dll!QQuickLoaderPrivate::load() Line 617 C++
      QtQuickd5.dll!QQuickLoader::loadFromSourceComponent() Line 514 C++
      QtQuickd5.dll!QQuickLoader::setSourceComponent(QQmlComponent * comp=0x01db1268) Line 492 C++
      QtQuickd5.dll!QQuickLoader::qt_metacall(QMetaObject::Call _c=WriteProperty, int _id=2, void * * _a=0x0018c5e4) Line 270 + 0xe bytes C++
      QtCored5.dll!QMetaObject::metacall(QObject * object=0x05d940d0, QMetaObject::Call cl=WriteProperty, int idx=45, void * * argv=0x0018c5e4) Line 308 C++
      QtQmld5.dll!QQmlPropertyPrivate::write(QObject * object=0x05d940d0, const QQmlPropertyData & property=

      {...}, const QVariant & value={...}

      , QQmlContextData * context=0x01e02318, QFlags<enum QQmlPropertyPrivate::WriteFlag> flags=

      {...}) Line 1375 + 0x17 bytes C++
      QtQmld5.dll!StoreProperty(QV8Engine * engine=0x01d8bff8, QObject * object=0x05d940d0, QQmlPropertyData * property=0x01e77398, v8::Handle<v8::Value> value={...}

      ) Line 694 + 0x25 bytes C++
      QtQmld5.dll!FastValueSetter(v8::Local<v8::String> __formal=

      {...}, v8::Local<v8::Value> value={...}

      , const v8::AccessorInfo & info=

      {...}) Line 911 + 0x1e bytes C++
      QtV8d5.dll!v8::internal::StoreCallbackProperty(v8::internal::Arguments args={...}

      , v8::internal::Isolate * isolate=0x007e6250) Line 991 + 0x2d bytes C++
      07f0a236()
      QtV8d5.dll!v8::internal::Invoke(bool is_construct=false, v8::internal::Handle<v8::internal::JSFunction> function=

      {...}, v8::internal::Handle<v8::internal::Object> receiver={...}

      , int argc=0, v8::internal::Handle<v8::internal::Object> * args=0x00000000, bool * has_pending_exception=0x0018cc1b, v8::internal::Handle<v8::internal::Object> qml=

      {...}) Line 137 + 0x17 bytes C++
      QtV8d5.dll!v8::internal::Execution::Call(v8::internal::Handle<v8::internal::Object> callable={...}

      , v8::internal::Handle<v8::internal::Object> receiver=

      {...}, int argc=0, v8::internal::Handle<v8::internal::Object> * argv=0x00000000, bool * pending_exception=0x0018cc1b, bool convert_receiver=false, v8::internal::Handle<v8::internal::Object> qml={...}

      ) Line 206 + 0x23 bytes C++
      QtV8d5.dll!v8::internal::Execution::Call(v8::internal::Handle<v8::internal::Object> callable=

      {...}, v8::internal::Handle<v8::internal::Object> receiver={...}

      , int argc=0, v8::internal::Handle<v8::internal::Object> * argv=0x00000000, bool * pending_exception=0x0018cc1b, bool convert_receiver=false) Line 173 + 0x2d bytes C++
      QtV8d5.dll!v8::Function::Call(v8::Handle<v8::Object> recv=

      {...}, int argc=0, v8::Handle<v8::Value> * argv=0x00000000) Line 3726 + 0x27 bytes C++
      QtQmld5.dll!QQmlJavaScriptExpression::evaluate(QQmlContextData * context=0x01e02318, v8::Handle<v8::Function> function={...}

      , int argc=0, v8::Handle<v8::Value> * args=0x00000000, bool * isUndefined=0x00000000) Line 192 + 0x20 bytes C++
      QtQmld5.dll!QQmlJavaScriptExpression::evaluate(QQmlContextData * context=0x01e02318, v8::Handle<v8::Function> function=

      {...}, bool * isUndefined=0x00000000) Line 139 + 0x1c bytes C++
      QtQmld5.dll!QQmlBoundSignalExpression::evaluate(void * * a=0x0018d090) Line 237 C++
      QtQmld5.dll!QQmlBoundSignal_callback(QQmlNotifierEndpoint * e=0x01df1d7c, void * * a=0x0018d090) Line 398 C++
      QtQmld5.dll!QQmlNotifier::emitNotify(QQmlNotifierEndpoint * endpoint=0x01df1d7c, void * * a=0x0018d090) Line 95 + 0x1d bytes C++
      QtQmld5.dll!QQmlData::signalEmitted(QAbstractDeclarativeData * __formal=0x01df1b68, QObject * object=0x01df1b58, int index=42, void * * a=0x0018d090) Line 590 + 0x13 bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01df1b58, int signalOffset=27, int local_signal_index=15, void * * argv=0x0018d090) Line 3333 + 0x1e bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01df1b58, const QMetaObject * m=0x5c09f170, int local_signal_index=15, void * * argv=0x0018d090) Line 3315 + 0x1e bytes C++
      QtQuickd5.dll!QQuickMouseArea::clicked(QQuickMouseEvent * _t1=0x0018d0b8) Line 824 + 0x15 bytes C++

      Here is the Call Stack of the qv8bindings.cpp memory leak:

      > QtQmld5.dll!QV8Bindings::QV8Bindings(QQmlCompiledData::V8Program * program=0x01e32370, unsigned short line=39, QQmlContextData * context=0x01eaf3c8) Line 288 C++
      QtQmld5.dll!QQmlVME::run(QList<QQmlError> * errors=0x01eaf168, const QQmlVME::Interrupt & interrupt={...}

      ) Line 804 + 0x66 bytes C++
      QtQmld5.dll!QQmlVME::execute(QList<QQmlError> * errors=0x01eaf168, const QQmlVME::Interrupt & interrupt=

      {...}) Line 197 + 0x10 bytes C++
      QtQmld5.dll!QQmlIncubatorPrivate::incubate(QQmlVME::Interrupt & i={...}

      ) Line 287 + 0x16 bytes C++
      QtQmld5.dll!QQmlEnginePrivate::incubate(QQmlIncubator & i=

      {...}, QQmlContextData * forContext=0x01eaf068) Line 97 C++
      QtQmld5.dll!QQmlComponent::create(QQmlIncubator & incubator={...}

      , QQmlContext * context=0x01eaedb8, QQmlContext * forContext=0x00000000) Line 1073 C++
      QtQuickd5.dll!QQuickLoaderPrivate::_q_sourceLoaded() Line 731 C++
      QtQuickd5.dll!QQuickLoaderPrivate::load() Line 617 C++
      QtQuickd5.dll!QQuickLoader::loadFromSourceComponent() Line 514 C++
      QtQuickd5.dll!QQuickLoader::setSourceComponent(QQmlComponent * comp=0x01de0368) Line 492 C++
      QtQuickd5.dll!QQuickLoader::qt_metacall(QMetaObject::Call _c=WriteProperty, int _id=2, void * * _a=0x0018c5e4) Line 270 + 0xe bytes C++
      QtCored5.dll!QMetaObject::metacall(QObject * object=0x01eaee98, QMetaObject::Call cl=WriteProperty, int idx=45, void * * argv=0x0018c5e4) Line 308 C++
      QtQmld5.dll!QQmlPropertyPrivate::write(QObject * object=0x01eaee98, const QQmlPropertyData & property=

      {...}, const QVariant & value={...}

      , QQmlContextData * context=0x01dee490, QFlags<enum QQmlPropertyPrivate::WriteFlag> flags=

      {...}) Line 1375 + 0x17 bytes C++
      QtQmld5.dll!StoreProperty(QV8Engine * engine=0x01dbcfd0, QObject * object=0x01eaee98, QQmlPropertyData * property=0x01e389a8, v8::Handle<v8::Value> value={...}

      ) Line 694 + 0x25 bytes C++
      QtQmld5.dll!FastValueSetter(v8::Local<v8::String> __formal=

      {...}, v8::Local<v8::Value> value={...}

      , const v8::AccessorInfo & info=

      {...}) Line 911 + 0x1e bytes C++
      QtV8d5.dll!v8::internal::StoreCallbackProperty(v8::internal::Arguments args={...}

      , v8::internal::Isolate * isolate=0x00576250) Line 991 + 0x2d bytes C++
      1c50a236()
      QtV8d5.dll!v8::internal::Invoke(bool is_construct=false, v8::internal::Handle<v8::internal::JSFunction> function=

      {...}, v8::internal::Handle<v8::internal::Object> receiver={...}

      , int argc=0, v8::internal::Handle<v8::internal::Object> * args=0x00000000, bool * has_pending_exception=0x0018cc1b, v8::internal::Handle<v8::internal::Object> qml=

      {...}) Line 137 + 0x17 bytes C++
      QtV8d5.dll!v8::internal::Execution::Call(v8::internal::Handle<v8::internal::Object> callable={...}

      , v8::internal::Handle<v8::internal::Object> receiver=

      {...}, int argc=0, v8::internal::Handle<v8::internal::Object> * argv=0x00000000, bool * pending_exception=0x0018cc1b, bool convert_receiver=false, v8::internal::Handle<v8::internal::Object> qml={...}

      ) Line 206 + 0x23 bytes C++
      QtV8d5.dll!v8::internal::Execution::Call(v8::internal::Handle<v8::internal::Object> callable=

      {...}, v8::internal::Handle<v8::internal::Object> receiver={...}

      , int argc=0, v8::internal::Handle<v8::internal::Object> * argv=0x00000000, bool * pending_exception=0x0018cc1b, bool convert_receiver=false) Line 173 + 0x2d bytes C++
      QtV8d5.dll!v8::Function::Call(v8::Handle<v8::Object> recv=

      {...}, int argc=0, v8::Handle<v8::Value> * argv=0x00000000) Line 3726 + 0x27 bytes C++
      QtQmld5.dll!QQmlJavaScriptExpression::evaluate(QQmlContextData * context=0x01dee490, v8::Handle<v8::Function> function={...}

      , int argc=0, v8::Handle<v8::Value> * args=0x00000000, bool * isUndefined=0x00000000) Line 192 + 0x20 bytes C++
      QtQmld5.dll!QQmlJavaScriptExpression::evaluate(QQmlContextData * context=0x01dee490, v8::Handle<v8::Function> function=

      {...}

      , bool * isUndefined=0x00000000) Line 139 + 0x1c bytes C++
      QtQmld5.dll!QQmlBoundSignalExpression::evaluate(void * * a=0x0018d090) Line 237 C++
      QtQmld5.dll!QQmlBoundSignal_callback(QQmlNotifierEndpoint * e=0x01ddfd9c, void * * a=0x0018d090) Line 398 C++
      QtQmld5.dll!QQmlNotifier::emitNotify(QQmlNotifierEndpoint * endpoint=0x01ddfd9c, void * * a=0x0018d090) Line 95 + 0x1d bytes C++
      QtQmld5.dll!QQmlData::signalEmitted(QAbstractDeclarativeData * __formal=0x01e21ec8, QObject * object=0x01e21eb8, int index=42, void * * a=0x0018d090) Line 590 + 0x13 bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01e21eb8, int signalOffset=27, int local_signal_index=15, void * * argv=0x0018d090) Line 3333 + 0x1e bytes C++
      QtCored5.dll!QMetaObject::activate(QObject * sender=0x01e21eb8, const QMetaObject * m=0x5deaf170, int local_signal_index=15, void * * argv=0x0018d090) Line 3315 + 0x1e bytes C++
      QtQuickd5.dll!QQuickMouseArea::clicked(QQuickMouseEvent * _t1=0x0018d0b8) Line 824 + 0x15 bytes C++

      I did a dump of the memory blocks after a call of collectGarbage() and also after all Qt libraries has been unloaded, but the two allocations from qv8contextwrapper.cpp line 175 and the one from qv8bindings.cpp line 276 are not being freed.

      Attachments

        1. Colors.js
          0.1 kB
        2. MemLeaksMain.qml
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            martinj Martin Jones
            reto Reto Hongler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes