minimicro-sysdisk icon indicating copy to clipboard operation
minimicro-sysdisk copied to clipboard

Mini Micro: textures leak

Open JoeStrout opened this issue 1 year ago • 0 comments

It turns out that in Unity, you can't rely on garbage collection to deallocate the native (unmanaged) memory associated with things like Texture2D. As a result, our textures are leaking. It's not a big issue in most apps, but if your app creates and forgets textures frequently (e.g., as part of an animation), it will add up.

To fix this we have to make our own manager that keeps track of ValWrappers that might reference a Unity object, or any object with an IDisposable interface. This has been prototyped and it works; we just need to clean it up and make sure we're not missing any other cases (e.g. sounds).

(Discord discussion here.)

JoeStrout avatar Feb 06 '25 14:02 JoeStrout