0
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%。MWFeedParser stringByReplacingXmlEntities內存泄漏
而且它砸我的登錄窗口:
__NSAutoreleaseNoPool(): Object 0x6d10ba0 of class UIView autoreleased with no pool in place - just leaking
爲什麼?我認爲方法之前良好的工作...
對於初學者,您正在泄漏第一個字符串 - 您擁有它,但立即用下一行中的新字符串覆蓋它。如果文檔很大,請考慮不使用自動釋放和可能可變的字符串。你是在一個單獨的線程中做這個嗎? – 2010-09-15 13:50:03