Hi,

I was profiling a section of my project which uses a Qml TreeView when I
noticed what seemed like a memory leak. So I created a small Qml
application to reproduce the problem, and there seem to indeed be a memory
leak in TreeView's.
The enclosed Qml file simply creates a TreeView, bind it to a
FolderListModel, and repetedly change the current folder from "C:\" to
"D:\" (I apologize to the Linux/Mac users in advance, feel free to replace
those 2 paths by some valid ones ^^)

Here is a screenshot of the resources used by the application run through
qmlscene

http://uploads.pcitron.fr/TreeViewLeak.png

Also note that when using complex delegates (which my case in my original
implementation) the problem is far worse.

So, is it something that I'm doing wrong ? Can anyone test this simple
application on other platforms to check if the same thing happen ?
Any help appreciated, thank in advance !!
import QtQuick 2.3
import QtQuick.Controls 1.4
import QtQuick.Window 2.2
import Qt.labs.folderlistmodel 2.1

Window {
        id: root

        visible: true

        width: 500
        height: 500

        Timer {
                id: timer
                interval: 0
                onTriggered: {
                        fileSystemModel.folder = fileSystemModel.odd ? 
"file:///D:/" : "file:///C:/";
                        fileSystemModel.odd = !fileSystemModel.odd;
                        timer.start();
                }
        }

        Component.onCompleted: {
                timer.start();
        }

        FolderListModel {
                id: fileSystemModel
                property bool odd: false
        }

        TreeView {
                anchors.fill: parent
                TableViewColumn {
                        title: "Name"
                        role: "fileName"
                        width: 300
                }
                model: fileSystemModel
        }

}
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to