In my application, i am downloading the XML data from server in a background thread, and do the parse and update the database tables
The background thread will be created during application start and keep running.
But the problem is during NSXMLParser Object release, i am getting EXC_BAD_ACCESS (SIGSEGV) Here is the XML Parser code:
- (void)parseXMLWithData:(NSMutableData *)pObjXMLBufferPtr
{
@try
{
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSMutableData *lTempData = [pObjXMLBufferPtr copy];
NSXMLParser *lObjXMLParserPtr = [[NSXMLParser alloc] initWithData:lTempData];
[lTempData release];
[pObjXMLParserPtr setShouldResolveExternalEntities: YES];
[pObjXMLParserPtr setDelegate: m_cObjSAXHandler];
//m_cObjSAXHandler is my custom class. here is declaration SAXHandler :
NSObject<NSXMLParserDelegate>
[pObjXMLParserPtr parse];
[lObjXMLParserPtr setDelegate:nil];
[lObjXMLParserPtr release];
lObjXMLParserPtr = (NSXMLParser *)nil;
}
@catch (NSException *ex)
{
NSLog(@"parseXMLWithData Exception!!!");
}
}
Here is the crash log:
0 libicucore.A.dylib 0x34c00578 ucnv_close + 28
1 libxml2.2.dylib 0x342a81ba xmlCharEncCloseFunc + 30
2 libxml2.2.dylib 0x342c62d0 xmlFreeParserInputBuffer + 28
3 libxml2.2.dylib 0x342aacbc xmlFreeInputStream + 108
4 libxml2.2.dylib 0x342aace4 xmlFreeParserCtxt + 12
5 Foundation 0x37d14b22 -[NSXMLParser dealloc] + 158
Please help me to resolve this issue.