内存泄漏这个简短的功能

Sam*_*mui 0 memory-leaks objective-c

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

- (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;
}
Run Code Online (Sandbox Code Playgroud)

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

Ody*_*dys 8

在你InformationScreenViewController.mdealoc方法中释放url.