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

Regression (Qt >= 5.12): Memory leak when passing QImage through QML

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.12.0, 5.12.1, 5.13.0 Alpha 1
    • None
    • OS: Windows 10 1803
      QImage, QQuickPaintedItem
      QtQuick 2.12+
    • Windows

    Description

      To be able to trigger the update of a live image from our sensor via QML, we use a QImage  property in the data source class and in the display class (QQuickPaintedItem). Whenever the QML Gui requests an update, the image is updated via assignment. See a minimal example attached.

      This worked well and efficiently with all Qt versions earlier than 5.12.x (latest working version is Qt 5.11.3). With Qt >= 5.12 a memory leak was introduced. By the amount of memory leaked per request it is clear, that the image is copied somewhere instead of implicitly shared (or not released).

      It might be that our approach is wrong, but it it is still weird that older Qt versions worked.

      Tested on Windows 10 only.

      Attachments

        1. leaks.zip
          697 kB
        2. memory-leak_qml-qimage_minimal.zip
          4 kB
        3. qtbug73388_memleak_qt5113.gif
          qtbug73388_memleak_qt5113.gif
          31 kB
        4. qtbug73388_memleak_qt5121.gif
          qtbug73388_memleak_qt5121.gif
          34 kB
        5. qtbug73388-valgrind.zip
          19 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mitch_curtis Mitch Curtis
            danra Daniel Rauch
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes