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

Qml doesnt free memory when javascript function is called inside createQmlObject untill application closed.

XMLWordPrintable

    • d50a57f408a9cc160c187c012f51b8fa89738858

      Please run the attached code in QtQuick 1.1 or QtQuick 2.0,
      and observe the dirty memory with pmap -x <PID>

      import QtQuick 1.1
      
      Rectangle
      {
          id: top
          width: 200; height: 200
          color: "white"
          property variant item
      
          Timer {
              id: timer
              running: true; repeat: true
              interval: 5
              onTriggered: {
                  if(item)
                      item.destroy();
                  item = Qt.createQmlObject('import QtQuick 1.1; Rectangle {color: "red"; width: 50; height: 50; radius: 20; anchors.centerIn:parent; function test(){}}',
                                            top);
              }
          }
      
          Timer{
              id: timer2
              running: true; repeat: true
              interval: 50
              onTriggered: gc();
          }
      }
      

      The Dirty memory increases constantly until the application is manually closed or closed by OOM killer in low memory devices.

      calling of gc() also doesn’t help.

      Also, if it doesnt have the javascript function "test" called, it works well.

      item = Qt.createQmlObject('import QtQuick 1.1; Rectangle {color: "red"; width: 50; height: 50; radius: 20; anchors.centerIn:parent}',top);
      

        1. 131108-qml2-create_and_destroy.qml
          7 kB
          Marek Wieckowski
        2. 131119-QTBUG-28712-qml2_with_loader.tar.bz2
          1 kB
          Marek Wieckowski
        3. 140804-QmlMemoryTest.tar.bz2
          1 kB
          Marek Wieckowski
        4. 140804-massif.out.7107
          412 kB
          Marek Wieckowski
        5. 140804-massif.out.7107.ods
          12 kB
          Marek Wieckowski
        6. 140804-ps-mem_usage.txt
          24 kB
          Marek Wieckowski
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            tapadar Indrajit Tapadar (Inactive)
            Votes:
            12 Vote for this issue
            Watchers:
            26 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes