Skip to main content
Known Participant
January 11, 2011
Question

Get free/used memory info

  • January 11, 2011
  • 1 reply
  • 1131 views

I'm writing code for a system that is very limited in it's memory. I've written some code to cache the data and movieclips used, but eventually I'll need to free some memory before I run out (and flash is terminated)

Is there a way to find out
- how much memory flash/my .swf is using in total?
- how much memory is free?
- how much memory an object or movieclip (including it's children) occupy?

I'm looking for something to decide wether or not I should release some memory. it doesn't need to be very precise, just anything I can use as an indicator in actionscript 2.0

I've found that in Flash Lite I can use

Code:
fscommand2("GetTotalPlayerMemory")
fscommand2("GetFreePlayerMemory");

but unfortunately I'm not using Flash Lite and these commands don't seem to exist in flash 7+.

Is there anything I could use?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 11, 2011

as3 has a few properties of the System class you can use.  just create an as3 swf with the needed memory checking code and have it load your as2 file for development purposes.

Roland684Author
Known Participant
January 11, 2011

With your suggestion I can calculate how much memory known data occupies (at design time). Unfortunately I do not know what will be loaded. It will be tekst and images, but at design-time I do not know how much text or how many images.

Even worse: I do not know how much memory will be available. This can vary greatly from run to run.

kglad
Community Expert
Community Expert
January 11, 2011

what would you do about it if your app is running on a problematic machine?