Memory Usage Help


(TheHuckleberryWill) #1

A few problems/questions…

  1. Differences in memory usage when running in browser to desktop flashplayer. Desktop uses a lot more.

  2. Ram usage starts at a number then climbs up and up, then crashes back down again. Loops doing this.

  3. Different RAM usage on different PCs. Way less on high end PCs than low end ones.

  4. How much RAM usage is acceptable?


(Zachary Lewis) #2

I’m only seeing one question here, so I’ll (poorly) answer that first.

How much RAM usage is acceptable?

It totally depends! I’m sorry this is such a shitty answer, but unless you have more information about the kind of machines running the software, it’s extremely hard to judge. I’d try to keep it under 512MB, but that number is completely made up.

Now, let’s look at the others.

Differences in memory usage when running in browser to desktop flashplayer. Desktop uses a lot more.

If you’re running the desktop debugger, there is going to be more memory usage, simply because the player is doing more. Since the web plugins are usually on a shared process, there is less overhead adding one more item to that plugin’s queue.

Ram usage starts at a number then climbs up and up, then crashes back down again. Loops doing this.

You’re seeing the garbage collector doing its job. Whenever a variable is no longer tracked (set to null, discarded, et cetera), it is marked for collection. Once the memory usage reaches a threshold (or whenever it finds a good time), the garbage collector purges that from memory, dropping the RAM usage.

Different RAM usage on different PCs. Way less on high end PCs than low end ones.

High end PCs have a faster processors, so they don’t rely on storing data to process later, they can just go ahead and run it. Also, the memory is usually much faster, so not as much data can accumulate in RAM before getting dealt with. (The garbage collector also runs more frequently.)


(TheHuckleberryWill) #3
  1. Your answer was perfectly acceptable!

  2. Ah, it was the debugger… Derp face

  3. Good old garbage collector… I thought there might be something up with my code.

  4. I see. Would be much better the other way round, high end PCs also have way more RAM…


(Ultima2876) #4

I’d aim for less than 256mb of memory usage, 512mb as an absolute maximum. Really, most flash games should ideally be under the 128mb mark, but this can be difficult to achieve if you have a large amount of spritesheets etc.


(TheHuckleberryWill) #5

Thanks, what sorts of things use up memory?


(Ultima2876) #6

Pretty much everything. Every object, variable, graphic, your actual program code, audio buffers, the flash runtime itself, etc. The biggest memory hog tends to be the graphics, however - with games running in Stage3D with no bitmap fallbacks in standard memory the memory usage can go as low as 10-20mb (with video memory usage around 80-100mb).