[solved] QML increasing memory usage
-
I've been trying to use a loader to load different QML 'pages' in my application and have found that eventually it runs out of memory. From running this through a memory analyzer it seems that the number of QScriptObject::Data and QScript::QVariantDelegate seem to keep increasing. The simple code is shown at the bottom.
You'll see from this that I've also tried using a page / page stack from the QML components, but this uses memory even faster!
@Rectangle {
id: mainItem
anchors.fill: parentTimer { running: true interval: 500 repeat: true property bool p1: true onTriggered: { if (p1) { console.log("A") p1 = false //localPageStack.push(page2) pageShow.sourceComponent = page2 } else { console.log("B") p1 = true //localPageStack.pop() pageShow.sourceComponent = page1 } } } Component { id: page1 // Page { Rectangle { anchors.fill: parent Rectangle { anchors.fill: parent color: 'white' Text { text: "Hello" } } } } Component { id: page2 //Page { Rectangle { anchors.fill: parent Rectangle { anchors.fill: parent color: 'white' Text { text: "Goodbye" } } } } Loader { id: pageShow anchors.fill: parent sourceComponent: page1 } //Component.onCompleted: localPageStack.push(page1) //screen area //PageStack { // id: localPageStack // anchors.fill: parent //}
}
@