开发者

Memory leak in Instruments

开发者 https://www.devze.com 2023-02-11 16:16 出处:网络
running my app through Instruments \"Leaks\" it\'s saying I\'ve got a leak which seems to happen with this code -

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.

0

精彩评论

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

关注公众号