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 when using sourceSize on images in list views?
Forum Updated to NodeBB v4.3 + New Features

Memory leak when using sourceSize on images in list views?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 952 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
    ChThChTh
    wrote on last edited by
    #1

    Hi.

    I'm having memory problems in my application that appears to be due to using sourceSize on images in list views. I've included a small QML-example below that illustrates the issue. It requires a bunch of images in the current directory, which I have not included.

    When scrolling to the end or the beginning of a list view, I expect to see the memory allocation of qmlscene to drop, since list items are released. When setting sourceSize equal to the image size, the allocation increases for each image coming into view, but never decrease. Scrolling back and forth for a while seems to increase the memory use more and more.

    However, setting the sourceSize to something different than the image size (such as five times larger), does show the expected behaviour at the end and beginning of the lists.

    Thing is, in my real application, I'm changing out loads of list items at fast rates in list views, and the memory consumption goes through the roof, since list items (or at least the pixmaps in them) that I expect to go away linger somewhere.

    Could someone confirm/speculate a bit on if this is indeed a memory leak in Qt and if I should file a bug report, or is this some sort of feature or effect of how sourceSize is supposed to work?

    @
    import QtQuick 2.0
    import Qt.labs.folderlistmodel 2.1

    Rectangle {
    id : viewer
    width: 800
    height: 480

    ListModel {
        id : picSrcList
    }
    
    FolderListModel {
        id: folderModel
        nameFilters: ["*.png", "*.jpg"]
    }
    
    Component {
        id : picDelegate
        Image {
            id: dynamicImage
            source: fileName
            sourceSize.width: dynamicImage.width // * 5
            sourceSize.height: dynamicImage.height // * 5
            width: 200
            height: 200
        }
    }
    
    ListView {
        id: picListView
        anchors.fill: parent
        delegate: picDelegate
        model: folderModel
        orientation: ListView.Vertical
    }
    

    }
    @

    Win7, Linux, 5.2, 5.3
    Possibly related to https://bugreports.qt-project.org/browse/QTBUG-37013

    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