Hi there,
I've only recently started looking into the issues concerning module unloading and its connection with application contexts.
I have added a small interface to Spring Actionscript called IDisposable, its very simple and looks like this:
Code:
public interface IDisposable {
function get isDisposed():Boolean;
function dispose():void;
}
This interface needs to be implemented by objects that hold references to resources (eventlisteners and such). The ApplicationContext itself now also implements this interface and what it does is to loop through its internal cache of singleton objects, checks if each objects implements IDisposable, and if so, calls its dispose() method. After that it clears its cache and nulls it.
So, before unloading a module you can invoke the dispose() method on the context, after which, hopefully, it'll properly release memory and resources.
I have also implemented the interface in several of the exisiting framework classes that are used by the context (such as the eventhandler processor, etc).
This is still a work in progress and not tested very thoroughly yet, but if you feel up to it you can check out the latest trunk of SpringAS and play around with it. I would greatly appreciate your help and findings.
cheers,
Roland