开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜