QQuickPaintedItem and memory release
-
Hi Qt community!
I am using a QQuickPaintedItem for my application (for Windows and iOS platforms) with Qt 5.14.2 and with FBO target.
The memory used by QQuickPaintedItem can be very huge on iOS with antialising activated (the devicepixelratio factor and the number of samples used are in cause apparently)
By desactivating the antialiasing i have a moderate memory consumption (acceptable), but i would like now to release this memory when the item is no more visible, and then to restore the view when come back to visible. Using a loader is working, however it is complex to put in place in my custom item as there is a lot of context i will have to serialize/deserialize to save and restore correctly the view (and also it will create a little latency).
The solution i want to put in place is to delete the inner texture the painter is using (or at least resize it to 16x16) when the item becomes invisible. That would allow saving a lot of memory while keeping all context in memory. But i dont manage to do that. In fact, if i change the texture size when the item becomes invisible, it seems that the texture is not actually resized. I suspect that the action of deleting or resizing the texture is done in the renderthread during updatePaintNode which is maybe not called when the item is not visible.
I tried to force a call to 'update()' when the item becomes invisible it works nearly allways... but not always.Do you have an idea about how i can release QQuickPaintedItem texture memory while the item is not visible, without detroying the whole Item?
Thank you.
JD