I have a simple Module (TestModule) that I can load and unload using
ModuleManager in a Flex Application (FlexApp).
Profiler shows the following two new Live Objects when TestModule
loads:
TestModule
_TestModule_mx_core_FlexModuleFactory
Each object has a total of 1 instance.
When I unload TestModule and force a GC, the TestModule instance and
memory drop to 0 which is good. However,
_TestModule_mx_core_FlexModuleFactory continues to have 1 instance
and is using memory.
When I grab "before and after" Memory Snapshots in Profiler, the
Factory instance appears in the Loitering Objects list. The Object
References for the Factory show 2 instances:
------------------------------------------------------------------
Instance Property
------------------------------------------------------------------
_TestModule_mx_core_FlexModuleFactory (2)
Function (2) [savedThis]
_TestModule_mx_core_FlexMod... moduleCompleteHandler
flash.display:LoaderInfo [listner0]
Function (1) [savedThis]
_TestModule_mx_core_FlexMod... docFrameHandler
Instance #2 is coming from the Module loading process and appears to
be unloading properly.
Instance #1 appears to be coming from mx.core:FlexModuleFactory.
However, this code is part of the "generated" ActionScript that I
cannot debug.
I tried loading TestModule into the "current" App Domain and I also
tried loading it into a separate "child" App Domain, however the
results were the same.
I'm using Flex Builder 3.0 (release). FlexApp is loading the
framework.swc as an RSL.
TestModule.mxml
---------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="200" height="100">
</mx:Module>
Questions:
How do I unload this Factory instance?
Why are there 2 instances under Loitering Objects when the Cumulative
Instance count is only 1?
Thanks for your help. I am really stuck on this.