2 Replies Latest reply on May 29, 2013 11:11 PM by gabriel montagné

    Is it possible to reclaim memory from "SWF Files"?

    gabriel montagné

      I'm working on an modular app which accumulates quite a bit of memory as "SWF Files".  I'm wondering if that data is redundant with the Bitmap and other ActionScript Objects that get created once the swf file is expanded and processed.  Or is it some other thing, like class definitions, which cannot be unloaded?




        • 1. Re: Is it possible to reclaim memory from "SWF Files"?
          Michael J.A. Smith Adobe Employee

          When you load a SWF, the data for that SWF, including all the embedded resources it contains, shows up under SWF Files. You can unload the SWF using Loader.unload(), and this will reclaim the memory for any embedded resources, but as far as I'm aware there's no way to unload class definitions (though these shouldn't be significant in terms of memory usage). If you unload the SWF though, you won't be able to use any of its embedded resources any more.


          There's no redundancy in Flash Player when you load a SWF - it doesn't make multiple copies of the raw bytes of embedded image data for example. However, it does keep a separate copy of the decoded image - it never destroys the original data (unless you dereference the image and it gets garbage collected), so that it's able to make the optimisation of disposing of the decompressed image if it's running out of memory and you aren't using it, and recreating it sometime later when you need to use it again (see the discussion here for some more detail: http://forums.adobe.com/message/5342232). The only difference, as far as image assets are concerned, between loading them directly with a Loader, and embedding them in a SWF, is that the former will show up under "Images" in Scout, and the latter under "SWF Files". In both cases, the decompressed image will show up under "Bitmap DisplayObjects".

          • 2. Re: Is it possible to reclaim memory from "SWF Files"?
            gabriel montagné Level 1

            Thanks Michael.   This is good to know : )