Do I need to delete ccobjects

Do I need to delete ccobjects
0.0 0


Just curious, do I need to delete cocos created objects like CCSprites? I’m coming from Java so yeah…


cocos2d-x has its memory management learning from NSAutoreleasePool in ios, called CCAutoreleasePool.
The previous discuss is here
Take care of the RefCount of CCObjects, when is RefCount is reduce to 0, the object will call “delete this;”
CCObject’s constructor, retain, release, autorelease will affect the RefCount.

If you get the object from static methods such as CCSprite::spriteFromABC(…), then the object~~>autorelease is already invoked once. You don’t need to call object~~>release() otherwise you call object->retain() before.