Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Scrolling of Listview causing huge memory consumption in Qt 5.0
Forum Updated to NodeBB v4.3 + New Features

Scrolling of Listview causing huge memory consumption in Qt 5.0

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.0k 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.
  • J Offline
    J Offline
    jitu
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Please show us your code.

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

      (Z(:^

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

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

        Greetz, Jeroen

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jitu
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            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.

            (Z(:^

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jitu
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jitu
                wrote on last edited by
                #7

                @import QtQuick 2.0

                Rectangle {
                id : viewer
                width: 800
                height: 480
                function addItem()
                {
                picSrcList.append({"src":"file:///C://Images//background.png"});
                picSrcList.append({"src":"file:///C://Images//folder.png"});
                picSrcList.append({"src":"file:///C://Images//tick.png"});

                }
                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()
                }
                

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

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

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

                  (Z(:^

                  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