I'm reworking the scene management in a game. I originally coded it to load all the scenes in advance in order to change scenes quickly, but that was causing crashes on some devices, evidently due to running out of memory. Changing it to keep only a few scenes loaded eliminates the the crashes, but the delays in switching scenes are frustrating.
What I'd like to do is test the free memory to dynamically determine how many scenes I can safely keep loaded. That way on devices with ample memory the game could continue to load all the scenes in advance and change scenes very quickly.
Is there a way to test the available memory, or something like a try/catch that could be used to attempt to load things in memory without causing a crash if there's not enough available?
PaulH
Comments
http://docs.giderosmobile.com/reference/gideros/EventDispatcher/Event.MEMORY_WARNING#Event.MEMORY_WARNING