I have read this part (it is a very good tutorial): http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_7_~~*Some_Icing_on_the_Cake
Where it says this:
- Pay attention to GameOverLayer.*label and GameOverScene._layer, they are declared in objc with @property , it means that they are retained, so they should be released in dealloc. Similarly, there is retain in init of GameOverLayer and GameOverScene, and release should be called in GameOverLayer\ andGameOverScene respectively.
- NSAutoReleasePool is also ported in cocos2d-x. This Garbage Collector is good for c++ programming, and the utility is the same as in iOS, more information refers to http://developer.apple.com/library/ios/#documentation/cocoa/reference/foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html.
In cocos2d-x, we should call release in two cases:
• The object is newed by ourself, for example, CCSprite sprite = new CCSprite;
• The object is created by a static function, for example, CCSpritesprite = CCSprite::spriteWithFile， in this case, we don’t need to release, but when sprite~~>retain() is called, then sprite->release() should be called too.