I've been doing some rapid prototyping for a game I'm thinking of building. one of the main things i want to do is map generation for a tile type map. While generating the map i end up using large amounts of ram. I'm building the map as an array of random integers for my test. When i try to generate maps of a large scale flash gives me the out of memory error:
Error: Error #1000: The system is out of memory.
I've already figured i could write to a file instead, to solve that problem. but does anybody know the actual maximum size? I've tried searching around to no avail.
Activity monitor reports that ADL is using around 500MB "real memory" and around 700MB "virtual memory". The System.privateMemory property seems to match the "real memory" value.
as a side note i'm developing in OSX Snow Leopard (64) with 8gb ram
EDIT:
Here the example test i am running
var ba:ByteArray = new ByteArray();
for(var i:uint = 0; i<100000000; i++)
{
ba.writeInt(int(Math.random()*100));
}
trace("end", ba.length, System.totalMemory);
This example runs fine, afterwards the total memory property reports around 500MB of ram used. Now increasing the target value to 400,000,000 i eventually receive the 'out of memory' error.
note: Testing in Flash CS5.5 with the timeout set to 120 seconds (the test never reaches that time)
EDIT:
i've created a better testing example:
var i:uint = 0;
var loopLength:Number = 500000000; // 500,000,000
var ba:ByteArray = new ByteArray();
for(i=0;i<loopLength;i++){
try{ba.writeInt(1);}
catch(e:Error){
MEM_TI.appendText(e.message);
break;
}
}
ba.position = 0;
MEM_TI.appendText("\nTM: "+System.totalMemory+" FM: "+System.freeMemory+" PM: "+System.privateMemory+" BALENGTH: "+ba.bytesAvailable/4);
When i run this script from a browser, stand-alone debugger or AIR i get roughly the same memory usage readouts (which i know vary anyway). What is constant however is the final length of the byte array:
Browser (Firefox): TM: 540413952 FM: 19116032 PM: 562573312 BALENGTH: 134217728
Stand-alone: TM: 540577792 FM: 1810432 PM: 545361920 BALENGTH: 134217728
AIR (2.6): TM: 5410816 FM: 1159168 PM: 551464960 BALENGTH: 134217728
My testing methods might not be perfect, though i dont know how to do deeper profiling.
As you work, After Effects temporarily stores footage, layers, rendered frames, and source images in RAM. This helps speed up editing and previewing. So, the more RAM you have available for After Effects to use, the faster you'll be able to work and render.
AIR can connect to device resources. With AIR you can prepare apps to run on any type of device. Adobe AIR can be independent installed on your device or be emmbeded in your App. Flash player (plug in or standalone app) is the simplest way to watch Flash SWF content on desktop (app) or in your browser (plug in).
Adobe® AIR® is a multi-operating system, multi-screen runtime that allows you to leverage your web development skills to build and deploy rich Internet applications (RIAs) to the desktop and mobile devices.
As of Windows 7, and AIR 3.3 Adobe AIR apps are limited to around 1GB memory allocation. This will change once Adobe AIR becomes 64-bit. Adobe plans to do 2 different rewrites of the platform. The first rewrite will take place by the end of 2012. This rewrite will add multithreading to the Flash, AIR runtimes. This first rewrite probably will not fix the existing memory allocation issues and limitations. But the second rewrite will for sure which is coming in 2013 codenamed "Next". This rewrite is the "ActionScript 4.0" which includes 64-bit runtime, memory allocation enhancements, programming language enhancements, new compiler, and a huge improvement in performance. Until then do not try to allocate more than 900MB of RAM at the risk of the app simple crashing without warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With