Memory Leak Mystery
Greetings. I'm almost finished with my first iPhone app, but have run into trouble with XML parsing. Instruments reports that the instantiation line sparks a memory leak in my parseXML method, but I can't figure out why. Here's the (entire) code for the method. Any guidance is greatly appreciated.
-(void)parseXML:(NSString *)xHC {
BOOL success;
NSURL *xmlURL = [[NSURL alloc] initWithString:hcXMLSource];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
[xmlParser setDelegate:self];
[xmlParser setShouldResolveExternalEntities:NO];
success = [xmlParser parse];
[xmlParser release];
[xmlURL re开发者_运维技巧lease];
}
I can't find the link but this is a bug in the simulator. It shows that there is a memory leak from the XmlParser when there isn't.
If you run the app through the device and track leaks it shouldn't find any.
I'll let you know if I find the link but I had this problem as well and this was the solution.
精彩评论