APRocha February 2016

Qt qml application increasing memory usage

I created an application with Qt/QML, load a qml file with QQuickView, and with this use a Loader element for change the pages(gui) inside application, and works fine, but my problem is the increase of the program memory usage (the application starts with less of 100MB, and after 1 day, the size is about 500 MB or more), I originally write and update the model of objects in Qml (javascript), but the application grows quickly, changing to create models with C++ objects, memory usage grows less but the problem is still not solved.

My model can be updated continuously (even 1 time per second), but I don't believe that be the reason of memory rises.

But with that problem come other strangers behaviors is with TableView when changes to that page, the memory rises even 10 MB, I try to free memory with gc(), but i don't get successful results, and in the change of page, the memory sometimes can rise by 1 MB.

Note: I use a Qt 5.5, and msvc 2010.

Answers


ddriver February 2016

You might want to check your application for memory leaks. That sounds a little excessive, even for QML, which is not known for memory efficiency.

Keep in mind, the QML engine will over-provision and will not release memory even when that seems the logical thing to do. I've had cases of reaching gigabytes of memory usage in QML, having tens of thousands of QML objects "alive", and upon deletion of all the objects, memory usage doesn't come anywhere near the initial memory usage. The freed memory is usually a tiny amount, for example, having 1 GB of memory worth of objects, deleting all the objects frees only like 150 MB of memory. The good news is that memory will be reused, creating those objects again will push memory usage to the previous peak, not any further. So as far as memory in your application is concerned, you are set.

I don't know if that will stack with the rest of the OS processes, whether your application will release extra memory if your system runs out of ram.

Post Status

Asked in February 2016
Viewed 2,767 times
Voted 12
Answered 1 times

Search




Leave an answer