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

QML memory leak with Repeater + states

    XMLWordPrintable

    Details

    • Platform/s:
      Windows

      Description

      Problem

      When a Repeater model is refreshed and the repeated item has states, then we have a memory leak.

       

      Reproduce

      Execute and watch the memory grow:

      import QtQuick 2.10
      import QtQuick.Window 2.10
      import QtQuick.Controls 2.3
      
      Window {
          visible: true
      
          Repeater {
              id: repeater
              model: range(1, 1000)
      
              Label {
                  id: label
                  text: modelData
      
                  states: State {
                      PropertyChanges {
                          target: label
                      }
                  }
              }
          }
      
          function range(min, max) {
              var list = [];
              for (var i = min; i <= max; i++) {
                  list.push(i);
              }
              return list;
          }
      
          Timer {
              running: true
              repeat: true
              interval: 1
              onTriggered: {
                  repeater.model = repeater.model.reverse()
              }
          }
      }
      
      

       

        Attachments

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

          Activity

            People

            Assignee:
            shausman Simon Hausmann
            Reporter:
            toms toms
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes