I noticed that memory allocated for Image is not released.
Without launched app the system has the following memory values: 423MiB / 1985MiB (checked via nvidia-smi)
When I am launching app and clicking (changing Image source) several times the memory using is increasing (1 click adds 4-5MB): 1950MiB / 1985MiB
Setting "cache" property to false does not help.
I found workaround: change image visibility but in this case a lot Image items are needed.
Does a solution exist to use "source" property not "visible"?
qml source:
Image {
id: trg
anchors.fill: parent
cache: false
states: [
State {
name: "on"
PropertyChanges {
target: trg
source: "qrc:/1.png"
}
},
State {
name: "off"
PropertyChanges {
target: trg
source: "qrc:/2.png"
}
}
]
}
MouseArea {
property bool isOn: false
anchors.fill: parent
onClicked: {
if (isOn) {
trg.state = "on";
}
else {
trg.state = "off";
}
isOn = !isOn;
}
}
Unfortunately, it was a bug (QTBUG-61754 and a few more) which has already been fixed in the qt 5.9.2 snapshot (I used to use 5.9.1 version).