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

VectorImage leak memory when ListView delegate is invalidated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.1
    • Quick: VectorImage
    • None
    • Ubuntu 22.04, Ubuntu 24.04, Windows 11. Qt. 6.9.1

      Repro steps:

      1. Use a QSortFilterProxyModel as a model to ListView
      2. Set the ListView delegate to be a VectorImage and let the source be coming from the model as an ImageRole.
      3. Then whenever the proxy model calls invalidate() the memory consumption increase for each time. 
      4. VectorImage Component.onDestruction is called successfully and tests using Loader does not help.

      I am not sure if all the steps above is necessary, but at least this provokes it. Also I am not sure if this is just a VectorImage fault or if there are mechanisms in ListView that causes this. Switching from VectorImage to Image remove almost all leak.

      Attached is a minimal example on how to reproduce it, just add some .svg images. 

      The memory is never freed in the lifetime of the application, calling gc() does not help either. 

      Here you can see the memory increases each time "reshuffle" is called, from approx 3 to 5 sec in the graph, where I click reshuffle.

        1. image-2025-09-23-11-50-35-537.png
          331 kB
          eriksage
        2. main.cpp
          1 kB
          eriksage
        3. main.qml
          1 kB
          eriksage
        4. randomproxymodel.h
          0.9 kB
          eriksage
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.graphics.and.multimedia Qt Graphics Team
            eriksage eriksage
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes