Hello,

i have one application with several sections. Each section is created
with:

section=addChild(new MySection());

and destroyed with:

removeChild(section);
section=null;

Everytime i create one section, i destroy the previous ones.

The section MySection has one component MyComponent that has the
following script:

          private var _myVar:String;
          [Bindable] public function get myVar():String
          {
              return _myVar;
          }
          public function set myVar(m:String):void
          {
              if (m!=null)
              {
                  Alert.show("myVar was set on " + this.uid);
                  _myVar=m;
              }
          }

As i said previously, MySection has one MyComponent with the myVar
binded to a model on the ModelLocator:

<local:MyComponent myVar="{model.myModel}"/>

I realized via debugging that the setter of myVar was being called too
much times: the first time i create the section it's called one time;
on the second time, it's called three times; on the third time, four
times; and so on...

So, i placed that Alert.show("myVar was set on " + this.uid); on the
setter because i concluded that the references to MyComponent were not
being proper destroyed with the removeChild and section=null;

And i realized that effectively whenever i open the section, i have
one alert with a new uid, and one more alert with an old uid for each
time i was on the section.

That means that Flex is not removing the references to the sections
(they are not being garbage collected).

This is creating me big problems. How can i be sure that whenever i
remove MySection i do not have to worry with bindings on old
references that should already been removed?

Also, is it possible to see which references are on memory on a given
point on runtime, so i can time if it's really a problem with garbage
collecting?

Thanks,

João Saleiro


Reply via email to