Congratulations to our 2022 Qt Champions!

Memory leaks in TreeView ?

  • Hi there,

    I was investigating a constant memory growth in a QML application of mine, and I created a really simple QML application that uses a TreeView and a FolderListModel. I use a timer to repeatedly switch the folder of the model between 2 folders, and the memory used by the application keeps growing.

    Here is the application that I tested. You can save to a file and run directly through qmlscene :

    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;
    	Component.onCompleted: {
    	FolderListModel {
    		id: fileSystemModel
    		property bool odd: false
    	TreeView {
    		anchors.fill: parent
    		TableViewColumn {
    			title: "Name"
    			role: "fileName"
    			width: 300
    		model: fileSystemModel

    And here is a screenshot of the process explorer for qmlscene :

    TreeView leaks ?

    I would be interested if someone could run this little application on other platforms and tell me if they notice this behavior.
    Also, if this is a known leak, or if I do something that I shouldn't, I would be interested in a solution.

  • Lifetime Qt Champion


    I'd recommend bringing that topic to the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)

  • Hi,

    Thanks for the suggestion. I'm really not familiar with mailing lists (and a bit afraid of the quantity of emails I would receive if I was to subscribe to one such as Qt) Is there no other place where developers go ?
    Or do you think that I should report an issue ?

  • Lifetime Qt Champion

    You can modify your subscription and only get one digest, otherwise there's also the #qt IRC channel

  • Hi again !

    I finally registered to the mailing list in digests mode and sent my question there. I hope it will have a little more success than here :)
    Thanks !

Log in to reply