Memory leak in Instruments
running my app through Instruments "Leaks" it's saying I've got a leak which seems to happen with this code -
-(void)podAppears {
podCount ++;
NSString *podName = [NSString stringWithFormat:@"Pod%i",podCount];
Pod *thePod = [[Pod alloc] initWithOwner:self withName:podName];
[pods setObject:thePod forKey:podName];
[thePod release];
}
I can't see anything wrong, but I'm fairly new to Objective-C & memory management in开发者_运维百科 general. Any help much appreciated!
That code looks fine. When Instruments informs you of a leak, it tells you where the leaked object originated. It's likely that the actual leaking of that object is occurring elsewhere in your app. You should look at other locations where you access your Pod
objects.
精彩评论