I have found that by integrating Box2D elements into the game mapping through a particular scene, when I need to transition to another scene the problem of releasing objects occurs (i’m not sure which part of my Box2D causes this).
I can loose the problem by using transition with some delay, but eventually the problem will happen anyway.
So I decided to try out pushScene() function of CCDirector to push the Box2D scene into a stack, then I can go to another scene without problem (because no releasing or destructor function of that scene will be called). Then if I need to go back to the Box2D scene, I use popScene() function of CCDirector to pop the scene put onto the stack.
I don’t think it’s totally a benefit, the code should work in normal way. So I still want your help if anyone can give me some suggestions.
FYI: After found this problem, I found that onEnter() and onExit() are really useful functions to use for one time loaded of scene and initialize / reset values when go to it or go back to it later on. I believe this will reduce the time needed to load stuff, and memory usage.