0 Replies Latest reply on Aug 4, 2008 9:16 AM by Purume77

    BitmapAsset takes twice system memory. Why?

      In order to load a bitmap statically, I tried to use BitmapAsset class.
      2000x2000.jpg is the name of the image filename.
      The code is in the below.

      class ReBitmap {

      public var imgCls:Class;

      public function ReBitmap()
      var imgObj:BitmapAsset = new imgCls() as BitmapAsset;

      If I add the below code, It occupies main memory on windows.
      var reBmp:ReBitmap = new ReBitmap();

      reBmp occupies twice than normal bitmap.
      when I use 2000x2000 image size,
      I expected it occupies 16Mb but it takes almost 32Mb.

      Under Profiling on Flex

      the instance of ReBitmap takes amlost 16Mb
      and also the instance of ReBitmap_imgObj takes almost 16Mb
      That's why the twice of memory is occupied.

      The size of image in my application is very huge.
      I need to save the memory.

      Can anybody explain this situation ?


      Test No. 1. -> it takes 16Mb
      var bmpData:BitmapData = new BitmapData(2000,2000); // it takes 16Mb

      Test No. 2. -> also takes 16Mb

      var url:URLRequest = new URLRequest(" http://............../2000x2000.jpg");
      var loader:Loader = new Loader();
      loader.contentLoaderInfo.addEventListener( Event.COMPLETE, handler_ContentLoadComplete );

      private function handler_ContentLoadComplete(e:Event):void {
      var bmp:Bitmap = e.target.content as Bitmap;
      bitmapData = bmp.bitmapData;