(viz): memleak with textures
Description
A memory leak of dozens of Mb has been observed in applications having a volume rendering in an activity.
Steps to reproduce
This can't be reproduced in SightViewer.
However, this can be reproduced in ExActivities:
- Launch ExActivities
- Load an image
- Do the whole worfklow
- Open a memory monitor of your choice
- Swap several times between the two last activities
- Observe the memory used increases each time you back to the volume rendering activity (last one)
Technical specifications
For the record, here was the debug logic:
- removing the volume render service makes the memleak disappear;
- starting/stopping the service in SightViewer does not create a memleak;
- since this happens in an app with an activity this leads to think it might be linked with the resource management, because in this case, a new resource is created for object uid, which changes when an activity opens several times;
- in the release method, the developer wrongly assumed the resource was freed up correctly when deregistering it from its Ogre manager;
- simply add
_resource->unload()
solves the memleak
Test plan
Repeat "Steps to reproduce" and ensure there is no memleak left.