I see intermittent collapse in [parser release]. I would say that I see it in about 5% of cases, and the data that I process varies between each failure. Why I can’t understand why.
Before I submit an Apple bug report (which, with luck, will not be reproducible in the sample code), can anyone come across this and find out what might happen?
NSData *d = [data copy];
@synchronized (xmlParserLock) {
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:d];
[parser setDelegate:self];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
[parser parse];
[parser release];
[pool release];
}
[d release];
And here is the output of gdb 'where', which points to [parser release]:
#0 0x93d08d12 in xmlCharEncCloseFunc ()
#1 0x93cfc0e3 in xmlFreeParserInputBuffer ()
#2 0x93cfc08f in xmlFreeInputStream ()
#3 0x93cfbdac in xmlFreeParserCtxt ()
#4 0x961384d6 in -[NSXMLParser dealloc] ()
#5 0x00149de7 in -[MyParserClass parseResponse] (self=0x104e9f0, _cmd=0x1766dc) at /Users/mike/Documents/MyApp/Classes/MyParserClass.m:60
Thanks in advance for your help!
source
share