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);
      

        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