内存泄漏这个简短的功能

时间:2011-08-02 17:59:15

标签: objective-c memory-leaks

为什么这段代码会产生内存泄漏?

- (void)loadModalInfo
{    
    InformationScreenViewController *infoView = [[InformationScreenViewController alloc] init];
    infoView.url = [[NSBundle mainBundle] URLForResource:@"NewPatientInfo" withExtension:@"html"]; // LEAKING
   // [infoView setModalPresentationStyle:UIModalPresentationFormSheet];
    [infoView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [self presentModalViewController:infoView animated:YES];
    [infoView release];
    infoView = nil;
}

我是使用仪器的新手,我无法弄清楚为什么代码泄漏。 提前谢谢。

1 个答案:

答案 0 :(得分:8)

InformationScreenViewController.m方法的dealoc中发布网址。

相关问题