Qt World Summit: Register Today!

Scrolling of Listview causing huge memory consumption in Qt 5.0

  • Hi

    I have created a Qt 5.0 application. When I am running the application in windows 7, the scrolling of List view is causing huge memory consumption. The listview is a dynamic one.

    Please tell a solution for this issue.

  • Moderators

    Please show us your code.

    Are you talking about QML ListView or a QtWidget? How do you create the model and delegates?

  • Hi, bit more code and information to be of service to you. What Qt version, and like slerdzio says, some code

  • Im using QML ListView. The list is auto-scrolled on pressing a button. The memory consumption is increasing during this process.

    The code is confidential and I cannot share the code.

  • Moderators

    So we cannot really help you.

    ListView instantiates the delegate objects as needed (new entry is generated when it is coming into view), perhaps you are not managing it's memory well enough. As a general advice, experiment with "clip" property.

  • But how can 'clip' property help in this case?

  • @import QtQuick 2.0

    Rectangle {
    id : viewer
    width: 800
    height: 480
    function addItem()

    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: {

    This is an example code in which similar issue is seen. The memory consumption increases when we flick the list view.

  • Moderators

    I don't see anything amiss here. Maybe you need to turn of Image caching, or periodically run the garbage collector.

Log in to reply