Skip to main content
May 21, 2014
Question

Bitmap DisplayObjects cause a memory peak that kills IOS devices

  • May 21, 2014
  • 1 reply
  • 894 views

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!

This topic has been closed for replies.

1 reply

May 21, 2014

I forgot to mention that we are using Adobe Air version 13.00111.

User Unknow
Legend
May 21, 2014

Try to init your Starling on iOS with disabled Context Lose option. So Starling will not store all data in the ram. iOS dont't loose context comparing to Android

jadams602
Inspiring
May 22, 2014

It is not true that you can't lose context on iOS. If you are using the latest versions of Starling you don't have to store Bitmaps in memory either to restore context.  Storing Bitmaps in memory is the old way to handle restoring context in Starling.