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

QDeclarativeVME leaks

    XMLWordPrintable

Details

    Description

      There seem to be a memory leak in the declarative engine that occurs in many use cases. E.g by playing minehunt demo application causes continuos leaks of this kind. This is a clip of Valgrind output:

      ==7059== 324 bytes in 81 blocks are definitely lost in loss record 448 of 565
      ==7059== at 0x4025024: operator new[](unsigned int) (vg_replace_malloc.c:258)
      ==7059== by 0x41E291A: QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus>::SimpleList(int) (qdeclarativeengine_p.h:201)
      ==7059== by 0x41DD7E2: QDeclarativeVME::run(QDeclarativeVMEStack<QObject*, 128>&, QDeclarativeContextData*, QDeclarativeCompiledData*, int, int, QBitField const&) (qdeclarativevme.cpp:168)
      ==7059== by 0x41DD36A: QDeclarativeVME::run(QDeclarativeContextData*, QDeclarativeCompiledData*, int, int, QBitField const&) (qdeclarativevme.cpp:110)
      ==7059== by 0x41D2674: QDeclarativeComponentPrivate::begin(QDeclarativeContextData*, QDeclarativeEnginePrivate*, QDeclarativeCompiledData*, int, int, QDeclarativeComponentPrivate::ConstructionState*, QBitField const&) (qdeclarativecomponent.cpp:775)
      ==7059== by 0x41D255F: QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData*, QBitField const&) (qdeclarativecomponent.cpp:756)
      ==7059== by 0x41D2280: QDeclarativeComponent::beginCreate(QDeclarativeContext*) (qdeclarativecomponent.cpp:699)
      ==7059== by 0x418B99C: QDeclarativeVisualDataModel::item(int, QByteArray const&, bool) (qdeclarativevisualitemmodel.cpp:1053)
      ==7059== by 0x418B30F: QDeclarativeVisualDataModel::item(int, bool) (qdeclarativevisualitemmodel.cpp:946)
      ==7059== by 0x4175FEA: QDeclarativeRepeater::regenerate() (qdeclarativerepeater.cpp:332)
      ==7059== by 0x4175D1F: QDeclarativeRepeater::componentComplete() (qdeclarativerepeater.cpp:295)
      ==7059== by 0x41D2B1B: QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate*, QDeclarativeComponentPrivate::ConstructionState*) (qdeclarativecomponent.cpp:855)

      These leaks seem to vanish if the following change has been made in function QDeclarativeVME::run():
      //if (bindValues.count)
      ep->bindValues << bindValues;
      //if (parserStatus.count)
      ep->parserStatus << parserStatus;

      The count checks have been out-commented. This makes the delete[] operation to be later called also for arrays that only contain pointers that does not point to any created objects.

      Attachments

        Activity

          People

            aakenned Aaron Kennedy
            kiilholm Mikko Kiilholma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: