Cause and mechanism
A RenderTexture uses GPU image memory. If memory keeps growing when opening and closing a view, track who creates it, who uses it, and when its use ends. Release frees its GPU allocation; Destroy destroys the Unity object and can also free its GPU resources. Choose cleanup appropriate to owned versus temporary render textures.
Check and correct the setup
- Detach owned textures from camera/UI, release their backing storage, and destroy unneeded Unity objects.
Release / Dispose - Return GetTemporary textures with ReleaseTemporary. Do not apply owned-object destruction to assets or borrowed textures.
Release / Dispose - Match cleanup to the API: RTHandle.Release and buffer Dispose where appropriate. Clean up superseded size-dependent resources.
Release / Dispose
Limits and verification
Release leaves the RenderTexture object alive and its storage can be recreated. Remove users and verify memory stabilizes over repeated open/close cycles.
A focused diagnostic setup
Assign creation, borrowing and end-of-use ownership for a minimap texture. Cameras/UI reference it while a manager owns it.
Test in this order
- Inventory new, temporary-pool, RTHandle and asset acquisition paths.
Release / Dispose - Detach consumers and release once through the matching owner/API.
Release / Dispose - Check resize and reopen cycles against creation/release and object counts.
Release / Dispose
Interpret the result
Distinguish premature shared-resource destruction from retention after use. Extra release calls are not safer. Decide per owner whether to reuse the released object or destroy it.