Qt Fast Memory Usage

While working on a medium-sized Qt project, we noticed that memory consumption is surprisingly high when there is not much going on on the screen. My attempts to find some kind of memleak led me to the CREATE_QML_OBJECT macro, where qml instance objects are created. After removing all user ui elements from the downloaded qml file and leaving only four main ones, I got

Rectangle { Button {} CheckBox {} Slider {} TextField {} } 

And this thing consumes about ~ 1-1.5 MB.

I looked at QtQuick demos and there:

Demo version of the gallery . Just a bunch of controls, 100 MB at startup.

The same game demo . A simple game, after 5 minutes of playing 256 MB, is gone.

What really surprises me is the fact that a simple QtQuick QML application can consume a huge amount of memory. Does anyone know what causes this distribution, and is there a way to manage it?

Any help would be greatly appreciated.


Related links, did not find an answer there

QML large memory consumption?

QML application memory size

Performance Suggestions and Suggestions

+7
qml qt-quick
source share
1 answer

Its all driven by javascript garbage collector. Few things to try:

1) Call gc() immediately after loading the element, i.e. on Component.onCompleted:

2) Upload items to Loader. Therefore, they should not remain in memory when not in use.

This does not guarantee a reduction in memory, but may help a bit.

+2
source share

All Articles