Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Memory leak while using ListView

Memory leak while using ListView

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chenjie4255
    wrote on last edited by
    #1

    good morning everyone, I think i found a memory leak while using ListView and ListModel.
    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()
    }
    

    }@

    is my code has any problem?
    I report this "BUG?" to https://bugreports.qt-project.org/browse/QTBUG-31007
    does anybody could help me to test this code and find out if it has a memory leak.
    thanks so much.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved