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

Modifying QGraphicsItem which is not part of a view, causes increasing memory consumption

    XMLWordPrintable

Details

    • All
    • 1d09b0d1b28eaea17069f7359956640f31ea79c6 (qtbase/5.12, 28.9.2018, 5.12b1)

    Description

      When QGraphicsItem (QGraphicsTextItem in this scenario) is part of a QGraphicsScene, but the scene is not attached to a view, modifying the Item's geometry, contents or anything that requires redraw, increases memory consumption.

      This is caused by line:
      d->updatedRects << rect; (QGraphicsScene.cpp@3198)

      In this specific use-case, the scene may never be attached to a view, so the updatedRects QList is never cleared.

      Steps to reproduce:

      • Run attached sample
      • Observe memory usage
      • EXPECTED: Memory usage does not increase at such high rate (if at all)
      • ACTUAL: Memory usage increases a lot indefinitely

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            jussi_witick Jussi Witick
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes