I am frustrated! I am working on an application, using Flash CS3 + AIR, that involves some heavy content loading. I need to fetch some 140 gif files each around 400x400 in resolution and 50KB in size and display them in a TileList. The code that I am using is pretty standard stuff, (excerpts from the cellrenderer of my TileList):
Code:
private function loadImage(imageUrl:String):void
{
var imageLoader:Loader = new Loader();
var imageReq:URLRequest = new URLRequest(imageUrl);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageFetched, false, 0, true);
imageLoader.addEventListener(IOErrorEvent.IO_ERROR, imageFetchedFailed, false, 0, true);
imageLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, imageFetchedFailed, false, 0, true);
imageLoader.load(imageReq);
}
private function imageFetched(e:Event = null):void
{
if (sectionImageHolderSprite == null)
{
sectionImageHolderSprite = new Sprite();
this.addChild(sectionImageHolderSprite);
}
bitmap = new Bitmap((e.target.contentLoaderInfo.content as Bitmap).bitmapData);
bitmap.smoothing = true;
bitmap.cacheAsBitmap = true;
bitmap.name = "bitmap";
/* Set the display size appropriately - maintain the aspect ratio */
var imageAspectRatio:Number = (bitmap.width < bitmap.height) ? bitmap.width/bitmap.height : bitmap.height/bitmap.width ;
if(bitmap.width >= bitmap.height)
{
bitmap.width = 150;
bitmap.height = bitmap.width * imageAspectRatio;
}
else
{
bitmap.height = 150;
bitmap.width = bitmap.height * imageAspectRatio;
}
bitmap.x = 25;
bitmap.y = 25;
/* Add it to the display list */
sectionImageHolderSprite.addChild(bitmap);
}
One would think that the memory required for the images would be around 500KB each (assuming 3 bytes/pixel of raw bitmap data), totaling around 70MB. But when I see the memory in task manager, it takes around 320 MB. And my memory caps if I reload these images three times!
What is going on here? This is unacceptable

Firefox/chrome take around 20MB to display an equivalent page. Why does flash require so much memory? Or am I doing something awful here?