4 Replies Latest reply on Jun 22, 2010 8:09 AM by kostis alexandris

    ChildConstraintInfo and air memory leak

    kostis alexandris Level 1

      I am facing a serious memory leak problem with my air application. It consists of many canvas that are resized dynamically according to an xml file (top, left , width, height etch).Periodically, all the canvas are removed and redrawn. When i profile my application i observe that the child constraintinfo instances increase very much and use too much memory. I cannot control the memory leak. My application ends to use the most of my computer's memory (hundrends of MB). Garbage collector does not free any of my memory! Is there a way to get rid of this childconstraint info memory usage?

      I would like to emphasize that my application depends on displaying a group of canvases into a parent canvas, all of them dynamically positioned in the air window. Thank you !


        • 1. Re: ChildConstraintInfo and air memory leak
          kostis alexandris Level 1

          Well, i managed to stabilize the childconstraintinfo

          but the cumulative memory and the cumulative instances of it still increases. So my problem remains

          although the childconstraintinfo instances do not increase anymore. Any ideas?

          • 2. Re: ChildConstraintInfo and air memory leak
            Flex harUI Adobe Employee

            Memory leaks are usually not related to cumulative instances, just current

            instances.

            • 3. Re: ChildConstraintInfo and air memory leak
              visum

              May I ask how you got the ChildConstraintInfo instances to stabilize?

               

              I am having a very similar problem in what sounds like a very similar project.  I'm building a lot of "slides" which are dynamically generated and destroyed, and loop over and over.  I am having a problem with continuously expanding ChildContstratinInfo instances (current instances, not just cumulative).  The expanding instances eventually take up all the available memory.  From what I can glean from the profiler, it seems to be related to the Image component, but I have not been able to figure out beyond that.

               

              Thanks,

              -Benjamin

              • 4. Re: ChildConstraintInfo and air memory leak
                kostis alexandris Level 1

                Dear Benjamin
                Thanks god, I did managed to solve my problem! The whole concept is to make all the variable that you use null when you do not need them anymore! For example
                I had a cnavas with four children (eg images). After an interval i want to reuse the canvas and load 4 other images. the correct way to do this is:

                 

                image1=null;
                image2 = null;
                image3=null;
                image4 = null;
                parentCanvas.removeAllChildren()
                parentCanvas.removeAllElements()
                parentCanvas = null;

                 

                and

                 

                parentCanvas = new Canvas()
                imageX = new Image()  X=1,2,3,4
                parentCanvas.addChid(imageX)

                 

                Also mind to remove all the listeners of an object before you make you object null.

                 

                The whole concept is : At the end of every function make all the variables that you use NULL and remove all the children and the listeners!
                Doing this the garbage collector will do miracles!

                 

                And also if you use the settimeout try not to use parameters. for example do not use

                 

                timeout = setTimeout(delaytime, timerFunction, param1, param2, paramN)
                but try to use just

                 

                timeout = setTimeout(delaytime, timerFunction)