3 Replies Latest reply on Jul 28, 2009 2:02 PM by Flex harUI

    flash profiling of memory after clearing cache of home-made rsl files

    jedierikb-FYcduC

      I have a question about the flash memory profiling tools.

       

      Once I have completely loaded a swf file into my browser, complete with multiple home-made gigantic RSLs (not flex swzs), the memory footprint of my application is small; I have not instantiated any of the objects in the RSL files.  However, as stated earlier, the RSLs are very big files; full of embedded assets.

       

      If I clear my browser cache, those gigantic RSL files are deleted.

       

      Then, when I use my flash app to create objects from the RSL, flash profiler shows my memory footprint increase.  That makes sense; I just made some large objects.

       

      But from where did flash load those objects? 

      • I deleted the RSL files.
      • The flash profiler showed I was using hardly any memory, suggesting that the class files were not loaded into memory already.

       

      Are the files kept in a secondary file cache?  Is there a second memory cache?  Can I profile its size?

        • 1. Re: flash profiling of memory after clearing cache of home-made rsl files
          Flex harUI Adobe Employee

          See http://blogs.adobe.com/aharui/2008/09/using_the_flex_builder_3x_prof.html

           

          Profiler memory is memory allocated to actionscript properties, not other memory used to load files, draw pixels, etc.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: flash profiling of memory after clearing cache of home-made rsl files
            jedierikb-FYcduC Level 1

            Thanks for the link to your post!  That was informative.

             

            Three quick questions:

             

            1. If I have embedded assets in my swf (like 100+ BitmapAssets), can I use Flash Profiler to see the memory footprint of those assets before instantiating one of those objects?  I think the answer is no...

             

            2. If my app is linked to large rsl files (like the flex framework and rpc rsls), are those entire libraries loaded into memory (even though I cannot see them with the Flash Profiler -- unless I instantiate objects from those frameworks)?  A followup: what is the memory footprint of linking to the flex libraries before instantiating any flex objects?

             

            3. Can the Flash Profiler report the flash.system.System.totalMemory?  It would be preferable to get this information after clicking the gc button and before a memory snapshot.

            • 3. Re: flash profiling of memory after clearing cache of home-made rsl files
              Flex harUI Adobe Employee

              1. No. and the main footprint of a bitmap is probably is per-instance so the instance cost is probably what you're interested in.  Anything embedded is also a class and the first time you access the class the Class category should go up by a bit.

               

              2.  When your app requires an RSL, the SWF for the RSL is loaded into memory (in a buffer you can't see from the profiler), expanded and parsed (into even more memory that you can't see from the profiler).  Then as you access classes from the RSL, the profiler should show growth in the Class, Object and Function.  If you statically link just the code you need, the amount of memory to load the SWF and parse it will be smaller since it doesn't need space for classes you won't need, but after that it is the same.  The advantage of the RSL is that most folks end up using 200K or more from the RSLs so that's a download cost you pay the first time you run the app.  The Flex RSLs are pretty well deployed so your chances of having savings is pretty good.  Private RSLs for your app will do no good unless there is another app on the same domain that uses the RSLs.  See the modules presentation on my blog for more info

               

              3.  The profiler does not show System.totalMemory.  Even that number isn't the whole measure.  We're currently fans of PrivateBytes to measure total weight of the app.  But it depends on what problem you're trying to solve.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui