I’m again stuck with the termination problem of game, this time it’s beacuse of memory overflow I though, As when I replay the level, by following steps:
Step1: There is a menu button, on tapping which menu popup opens, this is achieved by a push scene that pushes a menu class ove the previous scene
Step2: In that menu popup, there’s three buttons:
1.back to game which resume game from previous state, this is achieved by popping up the scene,
2.replay level,
3.back to home,
The last two are achieved by replacing the scene, which leads to serious memory leak, because the dealloc of the previous class doesn’t get called, So, in allocation it shows memory increase of about 10-20mb, and no reduction. Which probably leads to termination of the problem.
How to overcome this problem? I’m badly stuck with it.
Well what i did to over come this problem was an tricky solution:
Here are the steps:
step 1: made a global variable (flag)
step 2: store action in that global variable, as to replay or to back home
step 3: pop up the pushed scene(that have released the memory of push scene)
step 4: check what flag is saying in schedule selector(to re-play, or to back to home)
step 5: replace the asked scene(that release memory of current scene)
This is how I achieved it, any suggestion over it will be highly appreciated.