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

BusyIndicator leaks memory in 5.9.4

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.9.4
    • Quick: Controls 2
    • None
    • MacOs 10.12.6, Qt Creator 4.5.0, clang 64 compiler, qmake project with default settings ("Qt Quick Application - Empty")

    Description

      The BusyIndicator leaks memory in 5.9.4. This does not happen with 5.9.3.

      How to reproduce

      Load and unload a component containing a BusyIndicator very often using a Loader, e.g., this simple code reproduces the issue (click button to start cycle):

      main.qml:

       

      import QtQuick 2.9
      import QtQuick.Controls 2.2
      
      ApplicationWindow {
        id: mainApp
        visible: true
        width: 800
        height: 600
        title: qsTr("Hello World")
      
        property int loadCounter : 0
      
        Timer {
          id: beat
          repeat: false
          interval: 1
          onTriggered: {
            loadBtn.clicked();
          }
        }
      
        Component {
          id: comp
          BusyIndicator {
            Component.onCompleted: {
              beat.restart()
            }
            Component.onDestruction: {
              beat.restart()
            }
          }
        }
      
        Loader {
          id: loader
          anchors.top: parent.top
          anchors.right: parent.right
          width: 400
          height: 400
        }
      
        Button {
          id: loadBtn
          text: "load"
          onClicked: {
            loadCounter++;
            var r = loadCounter % 2;
      
            if (r === 1) {
              loader.sourceComponent = comp;
            }
            else if (r === 0) {
              loader.sourceComponent = undefined;
            }
          }
        }
      }
      

      The app has to be visible in the foreground all the time (otherwise it will sleep and stop loading/unloading). I used a release build.

       

      Symptom

      Memory rises unbounded. I used the Mac Instruments Allocation tool to analyze this. While the BusyIndicators are loaded and unloaded, the memory rises and falls, but it peaks higher and higher every time, using more and more memory. Soon a simple application that started with 20MB total, takes up 50MB total and keeps rising, without any persistent objects created. 

      This does not happen when using Qt 5.9.3. With Qt 5.9.3, the memory fluctuates, but does not increase.

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            patrick_ patrick_
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes