7 Replies Latest reply on Jun 8, 2010 3:02 PM by Aaronius9er9er

    Deciphering profiler object references

    Aaronius9er9er Level 1

      Hey flexers,

       

      I'm working on trying to free a module from memory on a 3.3 SDK project.  At this point the first instance of ImageEditorPopUp (the pop-up that contains the module loader which contains the module) remains pinned in memory after closing the popup.  The following instances are cleaned up fine after closing the pop-up.  Here's what I've got in the profiler:

       

      http://screencast.com/t/Zjc1MDA0

       

      I've read through this and other posts: http://blogs.adobe.com/aharui/2009/08/what_we_know_about_unloading_m.html  The only thing I can see as being a potential problem at this point are styles, which I'm still narrowing down.  If you think you spot something from my profiler screen capture, I'd appreciate if you'd let me know.  Otherwise I'll continue on my way.

       

      Thanks,

       

      Aaron

        • 1. Re: Deciphering profiler object references
          Flex harUI Adobe Employee

          That looks ok.  Now look at the moduleFactory for the module.

          • 2. Re: Deciphering profiler object references
            Aaronius9er9er Level 1

            Thanks for responding Alex.  You're always on top of this stuff.  Here are the object references to the module factory:

             

            http://screencast.com/t/ZDcwMTRjZDIt

             

            So, if I understand correctly, it's saying that TheSansExtraPlainLightregular has a dictionary inside it that is referencing the module factory?  And, if so, why is that the case and how do I avoid it?

             

            Thanks.

            • 3. Re: Deciphering profiler object references
              Aaronius9er9er Level 1

              Another thing of note is that the "instances" and "cumulative instances" of the module factory never decrease; they continue accumulating.

              • 4. Re: Deciphering profiler object references
                Flex harUI Adobe Employee

                Cumulative doesn't matter.  It is only showing you how many ever got created

                just in case it is an unexpected number.  What matters is the number of

                instances in any memory snapshot.

                 

                Is it increasing or staying at 1?

                 

                The dictionary references are weak keys so they aren't a factor.  The

                loaderInfo is a bit suspicious.  I'd look at its call stack to see why it is

                still around.

                 

                But if you are stuck at 1 instance, then I'd be looking at styles brought in

                by the module.  And resources too.

                1 person found this helpful
                • 5. Re: Deciphering profiler object references
                  Aaronius9er9er Level 1

                  Sorry, I mis-spoke when I said "cumulative instances" in my original comment.  I updated it to say that neither the cumulative (obviously) and the current instances decrease.  For the module factory, these numbers continually increase and never decrease.  However the first instance of the module itself and the popup that contains it are pinned in memory while the instances that follow are cleaned up.

                   

                  Other than disecting each style I'm using in the module, how do I determine if styles are the source of my memory leak?

                   

                  I'll dig into the loaderInfo some more too.

                   

                  Thanks for the follow-up.

                  • 6. Re: Deciphering profiler object references
                    Flex harUI Adobe Employee

                    If current instances of the moduleFactory keeps going up, then I'm not sure

                    how you can say that only the first instance is pinned.  That normally

                    indicates that all instances are pinned.

                     

                    If you generate a link-report of the module, you can see what Styles it will

                    install (assuming Flex 3x).  You can compare to the set of styles in the

                    main app. Any style in the module not in the main app will cause a leak, but

                    only for the first instance.

                    • 7. Re: Deciphering profiler object references
                      Aaronius9er9er Level 1

                      We're talking about three different things:

                       

                      (1) module factory: continues going up

                      (2) module: first one pinned

                      (3) popup: first one pinned

                       

                      To debug some previous memory leaks I had commented out as many components as possible to get down to a slim-and-trim module that would be easy to profile.  I was then going to fix memory leaks as I uncommented each component.   That helped me solve quite a few problems until I got to the first-instance-pinned issues.  After a few cusswords and not seeing anything helpful in the profiler I uncommented everything on a whim and, who would've thought, no more memory leaks.  I still don't know what was causing them but it's looking good now and it's not worth my time to figure out what was truly the source of the problem.

                       

                      I did generate a link-report previously and didn't see anything suspicious regarding styles, but I didn't really know what I was looking for at the time.  With your description, hopefully I can be more productive in the future.  Thanks.