繁体   English   中英

MWFeedParser stringByReplacingXmlEntities内存泄漏

[英]MWFeedParser stringByReplacingXmlEntities memory leak

 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];

最后一行占用“仪器”>“泄漏”中的98.3%的内存。

它用以下命令粉碎了我的“日志”窗口:

__NSAutoreleaseNoPool(): Object 0x6d10ba0 of class UIView autoreleased with no pool in place - just leaking

为什么? 我认为该方法以前效果很好...

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

     [self performSelectorInBackground:@selector(load) withObject:loadingIndicator];
 [self performSelectorInBackground:@selector(getEvents) withObject:nil];

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

现在,我收到EXC_BAD_ACCESS消息。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM