<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Memory Management in Qml]]></title><description><![CDATA[<p dir="auto">Hello.<br />
I developed a program by Qt and Qml!<br />
My application  has several window that works with stackview.<br />
every time clicked on button, stackview push new window and if clicked on back, pop window!</p>
<p dir="auto">in this case I confront memory leak...<br />
MainWindow memory is 23.7 MB<br />
page1: 32MB<br />
page3: 33.7</p>
<p dir="auto">agian  back to main window<br />
MainWindow : 28MB<br />
page1: 33.8MB<br />
Page2: 33.8MB</p>
<p dir="auto">agian  back to main window<br />
Page4:39.2MB<br />
MainWindow: 39.2MB</p>
<p dir="auto">each window that opens, the memory increases!<br />
How can solved this?</p>
<p dir="auto">My stackview Code :</p>
<pre><code>toolBar: BorderImage {
    border.bottom: 8
    source: "qrc:/Icons/toolbar.png"
    width: parent.width
    height: 70
    Rectangle {
        id: backButton
        width: opacity ? 60 : 0
        anchors.left: parent.left
        anchors.leftMargin: 20
        opacity: stackView.depth &gt; 1 ? 1 : 0
        anchors.verticalCenter: parent.verticalCenter
        antialiasing: true
        height: 60
        radius: 4
        color: backmouse.pressed ? "#222" : "transparent"
        Behavior on opacity { NumberAnimation{} }
        Image {
            anchors.verticalCenter: parent.verticalCenter
            source: "qrc:/Icons/navigation_previous_item.png"
            Text {
                font.pixelSize: 42
                Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} }
                x: backButton.x + backButton.width + 20
                anchors.verticalCenter: parent.verticalCenter
                text: "back"
                color: "white"
                font.family: webFont.name
            }
        }
        MouseArea {
            id: backmouse
            anchors.fill: parent
            anchors.margins: -10
            onClicked:
            {
                stackView.pop()
                gc()
            }

        }
    }
    Text {
        font.pixelSize: 42
        Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} }
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        color: "white"
        text: "Irsa Soft"
        font.family: webFont.name

    }
}
StackView {
        id: stackView
        anchors.fill: parent
        // Implements back key navigation
        focus: true
        Keys.onReleased: if (event.key === Qt.Key_Back &amp;&amp; stackView.depth &gt; 1) {
                             stackView.pop();
                             destroyed()
                             gc()
                             event.accepted = true;
                         }

        initialItem: Item {

            width: parent.width
            height: parent.height
            MainMenu {
                anchors.fill: parent
                onClicked : stackView.push({item:url,destroyOnPop:true})
                onChangeToshowTraffic : stackView.push({item:url,destroyOnPop: true})
                onChangeToSaveEnter: stackView.push({item:url,destroyOnPop: true})
                onChangeTomission: stackView.push({item:url,destroyOnPop: true})
            }
        }

    }
</code></pre>
]]></description><link>https://forum.qt.io/topic/92171/memory-management-in-qml</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 06:40:39 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/92171.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 01 Jul 2018 08:04:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Memory Management in Qml on Mon, 29 Apr 2019 19:27:39 GMT]]></title><description><![CDATA[<p dir="auto">I too ran into this type of issue. I am currently pushing/popping between two windows, and am slowly increasing the memory until the app crashes. You ever find any insights or solutions to this issue?</p>
]]></description><link>https://forum.qt.io/post/525996</link><guid isPermaLink="true">https://forum.qt.io/post/525996</guid><dc:creator><![CDATA[While_e]]></dc:creator><pubDate>Mon, 29 Apr 2019 19:27:39 GMT</pubDate></item></channel></rss>