开发者

Why Xcode say it may leak?

I defined splitBarArr in .h开发者_Go百科 file:

@property (nonatomic, retain) NSMutableArray *splitBarArr;

And I also set it nil in viewDidUnload, and released it in dealloc.

Why XCode still say that it's a potential memory leak?

Img here: http://i.stack.imgur.com/3LMMZ.png


when assigning retain property the retain count increments by 1. Hence allocing array does +1 and assigning it to property via self does +1 again. The release in dealloc does -1 so you still have +1 left. Doing assigning like this will fix the problem:

self.splitBarArr = [NSMutableArray array];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜