Help with texture lifetime management when loading textures dynamically in a Custom engine
Posted: 24 Mar 2026, 17:08
Hi! I'm having issues with texture lifetime management when loading textures dynamically.
I'm working with a custom engine and I have implemented a TextureProvider
My problem:
MyTextureWrapper destructor is never called, even after:
1. Does Noesis cache textures globally beyond the View lifetime?
2. When/how are Texture objects returned from LoadTexture() expected to be released?
3. Is there an API to clear the texture cache or force texture release?
4. Should I be doing something different in my TextureProvider implementation?
Thanks!
I'm working with a custom engine and I have implemented a TextureProvider
- In LoadTexture(), I return Noesis::Ptr<Noesis::Texture>{new MyTextureWrapper(engineTexture)}
- MyTextureWrapper holds a strong reference to our engine's texture resource
- I cache weak references to textures in my backend to avoid reloading
My problem:
- After closing a View or removing UI elements that use the textures, the texture refcount never decreases
MyTextureWrapper destructor is never called, even after:
- Clearing the View elements that references the textures
- Destroying the View
1. Does Noesis cache textures globally beyond the View lifetime?
2. When/how are Texture objects returned from LoadTexture() expected to be released?
3. Is there an API to clear the texture cache or force texture release?
4. Should I be doing something different in my TextureProvider implementation?
Thanks!