1

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?

Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
  • I'm writing in AS2, BTW, although I can switch up to AS3 if its necessary for better memory management. – Robin Rodricks May 05 '09 at 09:37
  • 1
    I am using MSIE11 for a flash game, it always crashes after reaching 1.4GB, because that is the memory limit of the browser. The game has a huge memory leak though. I guess this does not matter after 10 years. :D – inf3rno May 07 '18 at 12:56

3 Answers3

2

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.

1

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];
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
1

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

Goodluck.

Community
  • 1
  • 1
George Profenza
  • 50,687
  • 19
  • 144
  • 218