views:

474

answers:

3

I need to store a lot of data coming in from a server into memory, so I have to write my memory-storage algorithms based on how much I can safely use without hanging up or crashing the browser.

Is there any safe size limit like 1MB or 100MB, that contents of global variables should not exceed?

+1  A: 

Have a look at this very similar question and as stated there as well, what you're after might be here.

Goodluck.

George Profenza
+1  A: 

There's no hard and fast limit, but for flash game development targeting mid-to-low end machines, we found that keeping our memory footprint below 500MB reduced random crashing significantly. :-D You'll probably see other scalability limitations (processing power, single threadedness) way before you see memory capacity limitations, unless you are generating a lot data locally, procedurally (e.g. with generated bitmaps.)

I always recommend switching to AS3, but I don't think memory management will be a show-stopper in AS2.

Nate Austin
A: 

You can check how much memory you are using with:

trace("MEMORY USAGE: " + (System.totalMemory/1048576) + "MB");

Use this to help keep locate memory leaks and to improve your garbage collection code.

In actionScript 2 they say you should both clear and delete dynamically created objects for quickest GC.

myArray[0] = "value";

myArray[0] = null; // to Garbage Collect
delete myArray[0];
Jenko