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%的内存。
它用以下命令打破了我的日志窗口:
__NSAutoreleaseNoPool(): Object 0x6d10ba0 of class UIView autoreleased with no pool in place - just leaking为什么?我认为这种方法以前工作得很好。
发布于 2010-09-15 23:05:53
经过更多的谷歌搜索后,我发现这一定是因为以下这些方法:
[self performSelectorInBackground:@selector(load) withObject:loadingIndicator];
[self performSelectorInBackground:@selector(getEvents) withObject:nil];因此,我尝试分配一个NSAutoReleasePool,并在方法中完成工作后释放它。
现在我收到了EXC_BAD_ACCESS消息。
在我决定在后台运行这些方法之前,这并没有发生。那么这里的问题是什么呢?
https://stackoverflow.com/questions/3718239
复制相似问题