AS3 Memory Leak
Found a memory leak in my code last week, and thought this one might be a good one to share.I have been really careful about any memory leaks, but missed this one.
I've created a class that generated views that I could attach as child to another view, this would get cached as a bitmap, animated, replaced with original then animated again as a bitmap and destroyed. While in this worked fine, I've found that the cleared views weren't being destroyed properly. After a bit of trial and error (I suspected the bitmap caching first) I've found that externally loaded SWFs were the culprit. so I added an REMOVED_FROM_STAGE listener to the function that generates the views, and get it to remove each added child. This allows for the items to be easily garbage collected.
0 Comments
Posted on 2010 Jul 19 by
Daniel