I Found a memory leak passibility when using replace scene followed by push scene.
I try to use push & pop scene for the simple game tip scene,
So when I want to replace menu scene to game scene, I simply replace the menu scene to game scene first,
and then push tip scene right after replace scene. (before setNextScene in CCDirector has called)
CCScene scene = GameScene::create;
CCScenetipScene = GameTipScene::create();
In the tip scene, it shows random game tip and pop scene itself in seconds.
In this situation, the original scene’s main layer (the scene that is showing before replaced to game scene)
might be leaked.
This passibility caused by replace scene and push scene sequence.
When I first call replaceScene, the m_bSendCleanupToScene in CCDirector is set to true,
but before the Director send the cleanup message to the original scene, m_bSendCleanupToScene is set to false by push scene.
So, if there’s any scheduled selectors or actions in the original scene, it might be leaked.
I’m now using cocos2d-x 2.0.4 but I checked recently released 2.1.4’s CCDirector class and it seems that there’s no big differences about this.
This is maybe a bug or my fault by using replace, push and pop not properly
BTW.. I’m sorry for my bad english
Thx for reading.