iphone - Cocos2D Scene Deallocation -
when dealloc method of cocos2d scene called? right when scene loaded? or after scene has finished loading?
additionally, must in dealloc method if plan on overwriting it?
apparently, cocos2d automatically removes nodes attached scene when scene deallocated. however, if plan on overwriting it, methods must call? how can manage scene make sure leak free, 100%? in advance!
ccscene's deallocator follows same rules other object's. run when reference count ccscene reaches zero.
a scene default doesn't care replace it, if you're changing scene transition, there period of time when 2 scenes exist @ same time. when transition ends, transition release reference first scene, last such reference, , first scene deallocated.
in scene deallocator, put cclog see when it's run. put 1 in each make sure.
in general, manually release object created using method starting alloc, new or copy, whether or not it's cocos2d object or otherwise. other creation methods, such cocos2d's node, not require manual release, unless have chosen retain object manually well, might advisable if not going add child node straight away.
as have said, adding node child not mean needs release; cocos2d handle one.
Comments
Post a Comment