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

Memory leak in QDeclarativeComponent

XMLWordPrintable

      Memory leak in QDeclarativeComponent:

      The memory consumption of this example does constantly rise:

      #include <QApplication>
      #include <QDeclarativeEngine>
      #include <QDeclarativeComponent>
      #include <QFileInfo>
      #include <QFile>
      #include <QDebug>
      
      int main( int argc, char ** argv )
      {
          QApplication a( argc, argv );
      
          QString fileName = QString(CURRENTDIR) + "/data/Text.qml";
          QFile file(fileName);
          file.open(QIODevice::ReadOnly | QIODevice::Text);
          QString data = file.readAll();
      
      
      
          while (true) {
              qDebug() << "test";
              {
                  Q_ASSERT(QFileInfo(fileName).exists());
                  QDeclarativeEngine engine;
                  engine.setOutputWarningsToStandardError(false);
                  QDeclarativeComponent comp(&engine);
                  comp.setData(data.toUtf8(), fileName);
                  //comp.loadUrl (fileName);
                  if (comp.status() == QDeclarativeComponent::Error) {
                      qDebug() << "error";
                      foreach (const QDeclarativeError &error, comp.errors()) {
                          qDebug() << error.description();
                      }
                  } else if (comp.status() == QDeclarativeComponent::Loading) {
                  }
              }
          }
      }
      

      It looks like the reference count of QDeclarativeCompiledData *compiledData() never goes do zero.

      See also: http://bugreports.qt.nokia.com/browse/QTCREATORBUG-2899

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

            thohartm Thomas Hartmann
            thohartm Thomas Hartmann
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes