简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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