I have a GameObject with an Animation component attached to it. I load some AnimationClips into it (via Resources.Load).
I then Destroy this GameObject and create a new one. Similarly I attach an Animation component to it and load some AnimationClips.
I was expecting this sequence to have constant memory bounds but in fact each time the GO is destroyed and recreated I get another 10Mb added to the AnimationClips (according to Unity’s profiler) and shortly afterwards my app is killed by iOS after a memory warning.
What must I do to force the memory from the AnimationClips to be reclaimed? I had assumed that destroying the GO would do the job (or the Animation component). I’ve also tried caching the clips and destroying them explicitly but Unity prevents that due to “possible data loss”. As far as I can tell I have no other references to the original GO or the clips that would prevent the GC from collecting them.