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

QSGBatchRenderer Holds Removed Elements Longer Than Necessary Under Certain Conditions

    XMLWordPrintable

Details

    • Windows

    Description

      In certain circumstances, it seems that the QSGBatchRenderer will hold on to nodes that have been removed far longer than necessary. This can cause an issue, if nodes are being created and removed frequently in a long-lived application (e.g., every second on a clock left running overnight).

       

      I have attempted to isolate the exact conditions that cause this, but so far have been unsuccessful. If I'm able to isolate it, I will update this description with a minimal reproducible example. In the meantime, here are the details as best I've been able to find.

       

      In our QML application, we have a QML structure essentially similar to the following:

       

      Window {
        property string text
        Loader {
          sourceComponent: {
            Repeater {
              model: text.split("")

              Text {
                text: modelData
      {{        }}}
      {{      }}}
            Item {}
            Item {}
            // etc...
      {{    }}}
      {{  }}}

        Timer {
          interval: 1
          repeat: true
          onTriggered: text = Math.random().toFixed(10)
      {{  }}}
      }

       

      (Note that this simple example does not reproduce the situation. I am still trying to find the precise conditions which cause it.) Neither the repeater, nor the repeated components are referenced elsewhere, and there should be nothing keeping them alive when the Repeater model property changes.

      After leaving the application running overnight, we attempt to change the Loader's component. This causes an application hang as the Renderer deletes millions of elements from its m_elementsToDelete list.

      Stack trace:

       

      Renderer::deleteRemovedElements locals:

       

      A simple work around is to put the Repeater in its own Loader inside of the main loader, and periodical toggle the Loader's active property on and off, to force it to free the deleted elements without letting them pile up.

      Attachments

        1. image-2020-10-15-14-57-00-813.png
          image-2020-10-15-14-57-00-813.png
          18 kB
        2. image-2020-10-15-14-58-12-560.png
          image-2020-10-15-14-58-12-560.png
          79 kB
        3. 0001-qsgbatchrenderer-cleanup-removed-elements-frequently.patch
          2 kB
        4. 1.png
          1.png
          47 kB
        5. 2.png
          2.png
          49 kB
        6. 3.png
          3.png
          281 kB
        7. 4.png
          4.png
          303 kB
        8. htop-after-24h.png
          htop-after-24h.png
          158 kB
        9. perf-pid23409.png
          perf-pid23409.png
          173 kB
        10. QSGBatchRendererBug.tar.gz
          128 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            zcapalbo Zachary Capalbo
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes