Unsolved QT is consuming large amount of memory and a crash occurs when memory is full.
I'm working on a Embedded QT project in my Company. We have our own devices and I'm working on creating user Interfaces on the display of our device. The device can have multiple Pages/Screens. User can add any number of QML objects in each Page.(Each Page corresponds to one qml file that contains the property related configurations of all QML objects added in that page).
We have a Software Tool through which user can create these Pages and QML objects in each page. Then the QML's corresponding to each page are downloaded to the device. These downloaded pages are displayed on the device.
User can switch between the Pages that are downloaded into the device. If user tries to open any Page for the first time, then it takes noticeable amount of time to draw all the QML objects. To avod this delay and improve the UI performance, all the Pages and each object in each page are created asynchronously in the backend with the help of QQmlIncubator when the device is started(Let's call it as Page Caching).
Before the Page Caching, Qt application is consuming around 20% of the memory.
If there are large number of Pages and large number of QML objects in each Page, more than 75% of the memory is consumed by QT application by the time Caching is completed. This is causing the memory to be 100% full and crash occurs after few seconds when tried to interact with the device.
In memory constrained Embedded applications, it is not good to consume so much memory by a single application. Is QT not handling this by default? If not, is there a way to optimise the QT application such that it does not use more than a certain percentage of memory?
I called gc() from one of the QML file but it did not clear any memory. I'm not sure how to use gc() properly. Please let me know the right usage of gc() and also whether gc() will help in resolving this issue.
@FeelFree : Your issue looks similar to mine. Please tell me whether you were able to resolve your issue?