首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MWFeedParser stringByReplacingXmlEntities内存泄漏

MWFeedParser stringByReplacingXmlEntities内存泄漏
EN

Stack Overflow用户
提问于 2010-09-15 21:45:59
回答 1查看 226关注 0票数 0
代码语言:javascript
复制
 NSURL *xmlUrl = [[NSURL alloc] initWithString:@"http://www.xml-document.xml"];
 NSString *converted = [[NSString alloc] initWithContentsOfURL:xmlUrl encoding:NSISOLatin1StringEncoding error:nil];

 converted = [converted stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
 converted = [converted stringByDecodingXMLEntities];

最后一行占用了Instruments > Leaks中98.3%的内存。

它用以下命令打破了我的日志窗口:

代码语言:javascript
复制
__NSAutoreleaseNoPool(): Object 0x6d10ba0 of class UIView autoreleased with no pool in place - just leaking

为什么?我认为这种方法以前工作得很好。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-09-15 23:05:53

经过更多的谷歌搜索后,我发现这一定是因为以下这些方法:

代码语言:javascript
复制
     [self performSelectorInBackground:@selector(load) withObject:loadingIndicator];
 [self performSelectorInBackground:@selector(getEvents) withObject:nil];

因此,我尝试分配一个NSAutoReleasePool,并在方法中完成工作后释放它。

现在我收到了EXC_BAD_ACCESS消息。

在我决定在后台运行这些方法之前,这并没有发生。那么这里的问题是什么呢?

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

https://stackoverflow.com/questions/3718239

复制
相关文章

相似问题

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