UPDATE:

It would seem I have the same memory problem even when using the
higher level ModuleLoader. I get the same results memory wise with my
system or the module loader. It still unloads the swf etc, but
continues to eat more and more memory.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical" creationComplete="init()">
        <mx:Script>
                <![CDATA[
                        import com.widget.IWidgetMod;
                        import mx.events.ModuleEvent;
                        import com.widget.CustomModLoader;
                        import flash.system.System;
                        
                        //private var loader : CustomModLoader = new 
CustomModLoader;
                        
                        private var lastLoaded : Object;
                        
                        private function init() : void
                        {
                                //lastLoaded = loader.loadMod('test-debug.swf', 
hold,[1,2,3]);
                                loader.url =" test-debug.swf";
                                loader.loadModule();
                        }
                        
                        private function ready( e : ModuleEvent) : void
                        {
                                trace("INIT");
                                ((e.target as ModuleLoader).child as 
IWidgetMod).init(null, [1,2,3]);
                                //loader.unloadModule();
                                //forceGC();
                        }
                        
                        private function forceGC() : void
                        {
                                trace("START MEM @ " + System.totalMemory);
                                try {
                                   new LocalConnection().connect('foo');
                                   new LocalConnection().connect('foo');
                                } catch (e:*) {}
                                trace("END MEM @ " + System.totalMemory);
                        }
                        
                ]]>
        </mx:Script>
        <mx:HBox width="100%">
                <mx:Button label="Load" click="init()"/>
                <mx:Button label="Unload" click="loader.unloadModule()"/>
                <mx:Button label="GC" click="forceGC();"/>
        </mx:HBox>
        <mx:ModuleLoader id="loader" width="100%" height="100%"
ready="ready(event)"/>
</mx:Application>

Reply via email to