首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >此短函数中的内存泄漏

此短函数中的内存泄漏
EN

Stack Overflow用户
提问于 2011-08-03 01:59:15
回答 1查看 180关注 0票数 0

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

代码语言:javascript
复制
- (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的新手,我不明白为什么会有代码泄露。提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-03 02:04:16

dealoc方法的InformationScreenViewController.m中,释放url。

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6916443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档