I came across something explaining how to use Flex Profiler in Flex Builder, and this was a HUGE help for troubleshooting memory leaks. I would definitely suggest a try. It is very easy to use. Some things I found while profiling my applications:
Avoid using collections (at least LARGE collections) as properties of Value objects. I had several types of value object classes in a Cairngorm application, and each of them had a "children" property that was an ArrayCollection and was used for filtering. When profiling, I found that they were one of my biggest memory absorbers, so I changed my application, instead saved βparentIdβ as an int and used it for filtering. Used memory has been drastically reduced. Something like that:
Old way:
public class Owner1 { public var id:int; public var label:String; public var children:ArrayCollection;
New way:
public class Owner1 { public var id:int; public var label:String; } public class Owner2 { public var id:int; public var label:String; public var parentId:int;
I also suggest removing event listeners when they are no longer needed.
Eric Belair
source share