Hello there,

My application has components containing menus (MenuBar) which are
transient in the display list, that is, these components can be
added/removed during application lifetime.  I noticed MenuBar objects
are not being garbage collected. Any ideas? Upon removal I am setting
the data provider to null, but no luck. Everything stays in memory.

A simple example of MenuBar component that's not getting GC-ed, below..

Thanks

     public class ActionMenuBar extends MenuBar
     {
         public function ActionMenuBar()
         {
             super();
             var dp:XML =
         <myMenu label='Sample Menu'>
             <menuitem label='MenuItem A'>
                 <menuitem label='SubMenuItem A-1'/>
                 <menuitem label='SubMenuItem A-2'/>
             </menuitem>
             <menuitem label='MenuItem B'/>
             <menuitem label='MenuItem C'/>
             <menuitem label='MenuItem D'>
                 <menuitem label='SubMenuItem D-1' type='radio'
groupName='one'/>
                 <menuitem label='SubMenuItem D-2' type='radio'
groupName='one'/>
                 <menuitem label='SubMenuItem D-3' type='radio'
groupName='one'/>
             </menuitem>
          </myMenu>;

             this.dataProvider = dp;
             this.labelField = "@label";

             addEventListener(FlexEvent.REMOVE, onRemove, false, 0,
true);
         }

         private function onRemove(event:FlexEvent):void
         {
             trace("------ ActionMenuBar removed");
             removeEventListener(FlexEvent.REMOVE, onRemove);
             this.dataProvider = null;
         }
      }




Reply via email to