This blog post by Alex Harui may help you: http://blogs.adobe.com/aharui/2009/08/what_we_know_about_unloading_m.html
The post may sound like it only deals with modules but applications suffer from the same problems. A lot of problems are either style related (fixed in Flex 4) or Resource Bundle related (fixed in Flex Hero).
Yes. I've seen presentation. Issue is not style related as my SandBoxToolBoxApp is vanilla (i.e. blank application).
Issue seems to be related with fact that it is loaded from SandBoxApp not MainApp loaded by bootstrap.
Can you show a code snippet of how SandBoxApp loads SandBoxToolBoxApp? What version of Flex are you using?
Using Flex 3.5.
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.securityDomain = SecurityDomain.currentDomain;
var application:Application = Application.application as Application;
app domain of bootstrap from SandBoxApp when loading SandBoxToolBox App
1st. Loader Info is SandBoxApp
2nd. Loader Info is MainApp
3rd Loader Info is BootStrap
This was verified through debugger that ApplicationDomain is that of bootstrap.
var bootStrapAppDomain:ApplicationDomain = application.loaderInfo.loader.root.loaderInfo.loader.loaderInfo.applicationDomain;
loadercontext.applicationDomain = new ApplicationDomain(bootStrapAppDomain);
var swfLoader:SWFLoader = new SWFLoader();
swfLoader.autoLoad = false;
swfLoader.loaderContext = loaderContext;
swfLoader.percentHeight = 100;
swfLoader.percentWidth = 100;
swfLoader.x = 0;
swfLoader.y = 0;
swfLoader.cachePolicy = UIComponentCachePolicy.OFF;
When i load SandBoxApp the boostrap is retrieved as follows:
1st. loader info is MainApp
2nd. loader info is of boot strap
bootStrapAppDomain = application.loaderInfo.loader.loaderInfo.applicationDomain;
I would try setting a breakpoint in SWFLoader.contentLoaderInfo_unloadEventHandler(). It should get called when you unload the app. It's needed to clean up MarshallPlan apps. Have you tried the profiler to look for references to the ToolApp?
You mentioned styles cause memory leaks. currently my sandbox application is being removed but if i continously load/unload the application memory consumption keeps going up on latest release version of player.
I'm using 3.5 and the Styles are being loaded and unloaded within the sandbox within a Compiled CSS. I also do see the UNLOAD SWF message for the resources when the sandbox is unloaded.
Is this issue address in 4.X? Should i be seeing this issue in 3.5?
Style leaks typically cause a one-time application or module leak and you shouldn't see them in MarshallPlan apps. I doubt this is your problem. Has the profiler helped you find the leak? Did you hit the breakpoint in SWFLoader?