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

Memory leak in Loader during debugging via QML debugger

XMLWordPrintable

    • Linux/X11, Linux/Yocto
    • d978f34dc (dev)

      During debugging of an application created using QML, which includes the Loader component, compiled in a debugging configuration in the QML object tree, ScreenInfo objects are accumulated in the program window object. After a critical memory consumption value, Qt creator crashes with the message malloc_consolidate(): invalid chunk size

      Below is the code of a minimal program to reproduce the problem

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          id: page
          width: 640
          height: 480
          visible: true
          
          Loader {
              anchors.fill: parent
              id: loader
          }
          
          Component {
              id: c1
              
              Rectangle {
                  color: "red"
              }
          }
          
          Component {
              id: c2
              
              Rectangle {
                  color: "green"
              }
          }
          
          Timer {
              property bool c: false
              interval: 500
              running: true
              repeat: true
              onTriggered: {
              if (c) {
                  loader.sourceComponent = c1
              }
              else {
                  loader.sourceComponent = c2
              }
              c = !c
              }
          }
      }
      

       

      Playback steps
      1. Build the project in a debug configuration
      2. Run the project in debug mode
      3. Switch to QML debugger mode
      4. Pay attention to the tree of QML objects, new ScreenInfo objects will appear in the page object, the amount of memory consumed will increase.

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

            diseraluca Luca Di Sera
            m.lyubimov Maxim Lyubimov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes