Profiler memory sample still showing unreferenced RenderTextures that have been Released long ago

I’ve got a situation in which I need to allocate and release RenderTextures semi-frequently. I’ve noticed that despite my RT.Release() calls, they still show up in the memory snapshots that I’m taking with the profiler in Unity. They do show up as “0 bytes,” but I’ve noticed that the garbage collector pauses seem to increase, the more of these RTs build up. Is there a reason why unity or the GC does not actually dispose of these empty RTs? I’m not holding onto their references, so maybe Unity is? Is there a way I can actually delete the references completely?

Thanks

Ahhh… right after I posted this I realized the solution. Just like with Texture2Ds, you need to Object.Destroy() RTs for Unity to actually release its reference to it for the GC to catch it.

1 Like