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

Memory leak while using ListElement with ListView

    XMLWordPrintable

Details

    Description

      code is quite simple, just a ListView and a delegate which's duty is to show the image from the model's data(src).
      the running of qml is ok, but when we flick the listview as many as times, i found the using memory is increased without a limit. it's possiable increase to 1GB if we try as many as times.
      attachmemt is the code.

      the code is show as follow :

      import QtQuick 2.0
      
      Rectangle {
          id : viewer
          width: 800
          height: 480
          function addItem()
          {
              picSrcList.append({"src":"file:///e:/pic/more/02z.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/01.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/02.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/02s.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/3.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/4.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/5.jpg"});
              picSrcList.append({"src":"file:///e:/pic/more/6.jpg"});
          }
          ListModel {
              id : picSrcList
      
          }
          Component {
              id : picDelegate
              Image {
                  source: src
                  fillMode: Image.PreserveAspectFit
                  asynchronous: true
                  width: viewer.width
                  height: viewer.height
              }
          }
          ListView {
              id :picListView
              anchors.fill: parent
              delegate: picDelegate
              model : picSrcList
              orientation : ListView.Horizontal
              snapMode: ListView.SnapOneItem
          }
          Component.onCompleted: {
              addItem()
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            chenjie4255 ChenJie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes