为什么这段代码会产生内存泄漏?
- (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;
}我是使用Instruments的新手,我不明白为什么会有代码泄露。提前谢谢。
发布于 2011-08-03 02:04:16
在dealoc方法的InformationScreenViewController.m中,释放url。
https://stackoverflow.com/questions/6916443
复制相似问题