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

Canvas memory leak

    XMLWordPrintable

Details

    • 86ac78bdc0dce95489f3f8af1b4b062f426d399c

    Description

      Consider this simple example

      import QtQuick 2.6
      
      ListView {
        width: 320
        height: 480
        model: 1000
        delegate: Canvas {
          id: canvas
          width: parent.width
          height: width
      
          onPaint: {
            var ctx = getContext("2d")
            ctx.strokeStyle = "red"
            ctx.lineWidth = 2
            ctx.beginPath()
            for (var i = 1; i < 20; ++i) {
              ctx.lineTo(Math.random() * canvas.width, Math.random() * canvas.height);
            }
            ctx.stroke();
          }
        }
      }
      

      Scroll down and up and see how memory consumed by the process goes up. Neither QPixmapCache::clear() nor QJSEngine::collectGarbage() nor QQmlEngine::trimComponentCache() help

      Attachments

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

        Activity

          People

            beemaster Roman Pasechnik
            beemaster Roman Pasechnik
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes