Search code examples
iphoneobjective-cioscocos2d-iphoneretaincount

cocos2d 2.x scene retainCount


I'm pushing a scene to the game I'm working on, after pressing a button in the main menu.

This scene is a gameplayScene which should have two layers ad childs: boardLayer and hudLayer.

for now I'm testing with the boardLayer, I'm using block to call the gameplayScene to close both itself and the boardLayer, but by the time I get there the retain count of both layer is 3 (seems to be increasing after setting the block to 2, and I'm not sure when it is going up to 3)

What cause this, and how should it be handled?


Solution

  • What cause this, and how should it be handled?

    What causes it is irrelevant unless you have a leak. Then you use the Allocations Instrument and/or Build and Analyze to track down and fix the memory accretion.

    retainCount is useless; don't call it. http://whentouseretaincount.com/