This forum is read only and just serves as an archive. If you have any questions, please post them on

7 years ago by TylerAppmobi

Hey All,

One of our users is trying to get his game on mobile through directCanvas for Android, but it's crashing due to the large amount of images he loads into memory.

Does anyone know if there is a way to unload images after the new prerendered canvas has been created, and if this is even a viable solution for preserving memory?

7 years ago by dominic

Of course it depends on the game, but I guess the memory consumption of the pre-rendered chunks outweighs the tileset graphics by far.

So either
a) make the maps smaller,
b) don't use pre-render or
c) remove all references to the image and the GC will free the memory

Option c) could be a bit difficult. It's referenced in the map's tileset, as well as in the global image cache and (depending on how the level was loaded/generated) in the level's resources array (see the end of the generated level file).

delete backgroundMap.tiles;
delete ig.Image.cache['media/foo.png'];
delete LevelFooResources[0]; // assuming only one tileset per level
Page 1 of 1
« first « previous next › last »