at work we are trying to load and unload Flex Applications from a long standing shell application. We have studied the appropriate documentation, especially this
but we have found that Flex simply will nor release memory once used, no matter how simple the flex application. I have put a couple of posts on my blog about it
In particular the second post seems to highlight what I would consider to be a bug.
As far as I can tell this has not been fixed in Flex 4. If I load and unload the most basic flex application possible it still leaves hanging references. The style mixins may have all been lumped into one mixin called '_Flex4Application_Styles' but this still creates a load of anonymous functions that get an unnecessary reference to the main application via the scope object (as explained in my post).
What is needed is a concerted effort to create an application unload mechanism that a Flex application can use when it is being unloaded (via the UNLOAD event perhaps) which should enable it to make sure that every object it created is eligible for garbage collection.
I really like the way that PureMVC segregates each separate core into its own object tree which can be dropped by one method Facade.removeCore(CORE_NAME). Maybe Flex could incorporate some sort of loaded application registry that can be used to removed the instances of manager classes specific to that application etc...
I am going to have to learn he source code :-) Is this something people are interested in?
What do other people think.
Has anybody out there successfully loaded and unloaded flex applications from within a shell application over a long period of time?
If you have a simple test case, file a bug.