Highlighted

Memory usage on loaded bitmaps.

Explorer ,
Feb 05, 2017

Copy link to clipboard

Copied

Hi,

When loading an image from a folder (1920x1920) and adding to stage, the memory use in Scout goes up to 14.4mb (Bitmap DisplayObjects).

When instantiating the same image from library and adding to stage, the memory stays at 3.6mb.

Am I missing something?

I'm running CS6 with Air 23.

Here's my code:

public function loadBitmap(): void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest("app:/assets/images/WIND.png"));
}
function onLoaded(event){
var bitmap:Bitmap = new Bitmap(event.target.content.bitmapData, "auto", true);
addChild(bitmap);
}
function loadFromLibrary(){
var bitmap:Bitmap = new Bitmap(new Wind(0,0), "auto", true);
addChild(bitmap);
}

Regards,

T

TOPICS
Performance issues

Views

300

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Memory usage on loaded bitmaps.

Explorer ,
Feb 05, 2017

Copy link to clipboard

Copied

Hi,

When loading an image from a folder (1920x1920) and adding to stage, the memory use in Scout goes up to 14.4mb (Bitmap DisplayObjects).

When instantiating the same image from library and adding to stage, the memory stays at 3.6mb.

Am I missing something?

I'm running CS6 with Air 23.

Here's my code:

public function loadBitmap(): void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest("app:/assets/images/WIND.png"));
}
function onLoaded(event){
var bitmap:Bitmap = new Bitmap(event.target.content.bitmapData, "auto", true);
addChild(bitmap);
}
function loadFromLibrary(){
var bitmap:Bitmap = new Bitmap(new Wind(0,0), "auto", true);
addChild(bitmap);
}

Regards,

T

TOPICS
Performance issues

Views

301

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 05, 2017 0
Advocate ,
Feb 13, 2017

Copy link to clipboard

Copied

1920x1920x4/1024=14400

Image consist from pixel. Width * height = amount of pixels. Each pixel can use alpha. So without alpha it's 3 channels RGB and with alpha it's 4 channels ARGB. So 1920x1920x4 it's width * height * channels count = 14745600 bytes it's 14 400 kb's or 14.4 mb

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 13, 2017 0
Explorer ,
Feb 13, 2017

Copy link to clipboard

Copied

Okay!

So somehow embedded library manages to ignore the alpha channel but still renders alpha?

Since they take 4 times less memory.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 13, 2017 0
Advocate ,
Feb 13, 2017

Copy link to clipboard

Copied

less memory it's 3 channel RGB without 4th - A. You can't use Alpha without it. Without alpha your PNG will be just JPG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 13, 2017 0
swamp222 LATEST
Explorer ,
Feb 13, 2017

Copy link to clipboard

Copied

Okay thanks!

/T

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 13, 2017 0