-
Client Software Programmer
Memory storage info
Hi, lately people are using bitmaps to store memory for convenience however there are some down sides when you chec out the ram consumption check this out:
trace(System.privateMemory);//14 mb default used by air
var bitmapData:BitmapData = new BitmapData(9000,9000,false,0x00FF00);
trace(System.privateMemory);
//323mb used up by bitmap giving you also 81million slots of memory storage
which is good because it is easy to access the memory slots, but it is bad because it makes you run out of memory sometimes.
now with this way you only use around 10mb for 81million memory slots, each slot holding up to 4 digits like 9999
//initial memory used= 13 to 14mb
trace(System.privateMemory);
var my_ba:ByteArray=new ByteArray();
var bm_storage={};
var i=0;
for(i=0;i<9000;i++){
bm_storage["slot_"+i]={ba:ByteArray};
}
trace(System.privateMemory);
//1.5ish mb used by creating that ^
for(i=0;i<9000;i++){
my_ba.writeShort(9999);
}
trace(System.privateMemory);
//.1mb used by creating that ^
for(i=0;i<9000;i++){
bm_storage["slot_"+i].ba=my_ba;
}
trace(System.privateMemory);
//1mb by creating that ^^
//total 81,000,000 million accessible memory slots for around 12mb
so it is better to use writeShort and objects so i can map my memory more efficiently and just as close as accessible.
Last edited by AS3.0; 12-11-2016 at 10:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|