My Qt Quick application is slowing down and consuming way too much memory when I load Images. I am loading around 5 PNG images that are large, about 50MB each.
See the size here:
Before loading the Images the memory consumption of the app is about 300MB, not too bad...Then when I load the 5 Images it jumps to 4.4 GB and stays there! ( I tried calling gc() on completed, it did nothing)
So I did some experiments. I wrote this basic application, just a QML Image. I executed without an image source, and the memory was 28.7 MB
import QtQuick 2.12
import QtQuick.Controls 2.3
Image {
id: imageId
anchors.fill: parent
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
//source: 'test_images/1.png'
}
This is a screen capture from Mac's 'Activity Monitor'
When I added the 50MB image as the source the memory consumption jumped to 1.39GB and stayed there! Even after gc() which did nothing...
import QtQuick 2.12
import QtQuick.Controls 2.3
Image {
id: imageId
anchors.fill: parent
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
source: 'test_images/1.png'
}
Another screen capture from 'Activity Monitor'
What is happening to this Image object to make it consume 1.39GB of memory! The image is only 50MB! This is the root of my problems with my app and it is making my application almost unusable. This is a major problem for the QtQuick platform.
Any comments or suggestions on how to resolve this? Thanks! I am using Qt 5.12


