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. Application memory increases a lot with a FileDialog: Using Loader this memory is not free
Qt 6.11 is out! See what's new in the release blog

Application memory increases a lot with a FileDialog: Using Loader this memory is not free

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 461 Views
  • 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.
  • Diego DonateD Offline
    Diego DonateD Offline
    Diego Donate
    wrote on last edited by
    #1

    Hi,

    I have a simple QML application where I open a FileDialog when a button is pressed.

    I have realized that when I open the FileDialog the current application memory is increased a lot (12 Mb only with the dialog), so I have added a Loader to the FileDialog. Therefore, the memory is only increased when I open the dialog. But my problem is that I can not free this memory, even setting the Loader source to "".

    My test file:

    import QtQuick 2.0
    import QtQuick.Controls 1.4
    
    Item {
        width: 400
        height: 400
    
        Loader {
            id: loaderFileDialog
        }
    
        Connections {
            target: loaderFileDialog.item
            onAccepted: {
                loaderFileDialog.source = "";
                console.log("onAccepted");
            }
            onRejected: {
                loaderFileDialog.source = "";
                console.log("onCancel");
            }
        }
    
        Button {
            anchors.centerIn: parent
    
            width: 100
            height: 50
    
            text: "Open file";
    
            onClicked: {
                loaderFileDialog.source = "qrc:/MyFileDialog.qml";
                loaderFileDialog.item.visible = true;
            }
        }
    }
    

    And my QML file with the FileDialog: MyFileDialog.qml

    import QtQuick 2.1
    import QtQuick.Dialogs 1.0
    
    FileDialog {
        id: fileDialog
    }
    

    What am I doing wrong? Any idea or suggestion?

    Thanks a lot in advance,
    Diego

    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