Hi guys,
I'm creating an iPad application that's basically an interactive book. The users can flip through the pages and interact with the elements on a page.
Each page is a CCLayer and I go from page to page using a CCTransitionPageTurn.
I'm having memory issues since my pages contain a lot of content:
* a background image (full screen)
* some sprites
* animations (I'm using SpriteFrameCache)
* sounds
My app sometimes crashes due to low-memory problems (the console only outputs "Program received signal: "0".") and this always happens when I go from one page to another. I get that having the 2 pages in memory at once can be memory-intensive but I was wondering how I can make sure I use my memory as optimal as possible.
What I'm doing now is the following:
* User flips the page
* Clean up some heavy animations I no longer need (remove frames and textures)
* Unschedule selectors
* Do page turn transition
* In onEnterTransitionDidFinish: add animations and textures for next page
* In cleanup-method: remove unused sprite frames and textures
For cleaning up an animation I do the following:
[animation.frames removeAllObjects];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeUnusedSpriteFrames];
[[CCTextureCache sharedTextureCache] removeTextureForKey:animationName];
I'm having the feeling that cleaning up the animations doesn't instantaneously free the memory.
So, my questions are:
1) Does anyone know what the average memory limit is for an iPad app?
2) Do you guys have some tips to improve my memory management
3) Am I cleaning up my animations correctly? Is there a way to speed up the freeing of the memory?
thanks for the help!