Reputation: 496
I defined splitBarArr in .h 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: https://i.sstatic.net/3LMMZ.png
Upvotes: 2
Views: 92
Reputation: 49354
when assigning retain
property the retain count increments by 1. Hence alloc
ing 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];
Upvotes: 8