开发者

Memory managment. Dealloc. iOS

Is this correct?

- (void)dealloc {

    [super dealloc];

    [stageObjects release];
}

Or should I c开发者_如何学JAVAall

[super dealloc]

Always after all releases, I mean last line of this function?


You must always call [super dealloc]; last. After all, this very object might always be deallocated after the call to super returns.


[super dealloc]; 

should be the last line to call in dealloc method.


You can also make macro as below for dealloc objects and because of it you should not write method every time.

RELEASE_SAFELY (object) [object release], object=nil

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜