Diego
Diego

Reputation: 357

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

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

Upvotes: 0

Views: 266

Answers (0)

Related Questions