We are developing an application with Qt/Qml (Qml is embedded in the QWidget). When deleting a QWidget that contains a QQuickView (embedded), the allocated memory won't be freed entirely.
By adding a QWidget to application, about 30MB of memory will be allocated but when the widget deletes, only about 20MB of memory will be freed.
In the destructor of QWidget, I have deleted the QQuickView instance and there are no other big objects.
Also, I am pretty sure that the QQuickView doesn't release memory properly.
How can I free entire memory allocated by QQuickView?
NOTE: The code is really big (160000 Lines), therefore I can't put sample code.
Thanks in advance...
I've written a quick test to determine if there is an actual leak in the creation and deletion of a
QQUickWidget
:It has a timer that creates/destroys a
QQuickWidget
with a loaded QML file inside, and although the results initially ramp up, the memory usage stabilizes in time, indicating it is not likely there was a memory leak in the Qt code, and that if you indeed leak memory, the fault does not lie in Qt but in your own code.Also, it is worth mentioning that the task manager actually showed the process using less memory than
GetProcessMemoryInfo()
, and I think the latter is the more accurate measure of the two. The task manager reading also didn't indicate any memory leaking although its value fluctuated more.Here is the output: