Bitmap DisplayObjects cause a memory peak that kills IOS devices
Hey there
We are creating a game using Starling in Adobe Air for IOS, Android, Kindle and Facebook and are coming across an issue with Bitmap DisplayObjects. The following profiling session was recorded in an android device with 1GB of memory:
http://dev.jojugames.com/projects/wicked/AndroidLogTutorial/001_CPUPeak.png
The problem is that IOS devices have only 512MB and crash frequently at the peak shown in the image above (154MB CPU + 148MB GPU, 302MB Total)
This peak happens because for 400 frames or so the AIR runtime decides to create some objects called "Bitmap Displayobjects" as a cache for decoded compressed textures to avoid re-decoding them in the future, and keeps these objects in memory for some arbitrary time (we tested disposing every single bitmap and texture but these objects remained in memory). The next figure shows these bitmap DisplayObjects in time:
http://dev.jojugames.com/projects/wicked/AndroidLogTutorial/002_BMDisplayObjects.png
The creation of these objects seems to be arbitrary because there are many times in the game where textures and bitmaps disposed and recreated because the game state changes (from map to game and vice versa), these parts are shown in the scout screenshot above with gray arrowed boxes.
We need to avoid creating these Bitmap DisplayObjects altogether, we don't care if texture decoding takes a little longer.
Please notice the following:
* From the first screenshot: the game uses half the memory of the peak during all gameplay
* From the second screenshot: most of the memory in the peak are these Bitmap Displayobjects.
* From the second screenshot: A lot of textures are created and uploaded to GPU memory without the use of Bitmap DisplayObjects.
Can anybody help us to configure the AIR runtime to avoid using these Bitmap DisplayObjects?
Thanks!
