Hi all,
in my app ,i am parsing xml files using NSXMLParser.to connect to url we are making use of NSURLConnection.we are using synchronous connection.this will return NSData type. In performance tool i am checking for leaks.
- (void)parseXMLFileAtURL
NSURL *)URL parseError
NSError **)error
{
theRequest=[NSURLRequest requestWithURL:URL];
NSError *connectionError= nil;
receivedData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&connectionError];
NSLog(@"\n\n---------Succeeded! Received %d bytes of data",[receivedData length]);
if([receivedData length] != 0)
{
//catalogObj = [Catalog getCatalogObject];
@try
{
parserObject = [[NSXMLParser alloc] initWithData:receivedData];
//receivedData = nil;
//theRequest = nil;
//response = nil;
}
@catch (NSException *e)
{
NSLog(@"ERROR : Name: %@\nReason: %@\n\n",e.name,e.reason);
}
[self.parserObject setDelegate:self];
[self.parserObject setShouldProcessNamespaces:NO];
[self.parserObject setShouldReportNamespacePrefixes:NO];
[self.parserObject setShouldResolveExternalEntities:NO];
@try
{
[self.parserObject parse];
}
@catch (NSException * e)
{
NSLog(@"ERROR : Name: %@\nReason: %@\n\n",e.name,e.reason);
}
@finally
{
NSError *parseError = [self.parserObject parserError];
if (parseError)
{
NSLog(@"\n------------------");
NSLog(@"\nPARSE ERROR OCCURED.....\nDescription: %@\nReason: %@\nSuggestion: %@\nInfo: %@\n\n",[parseError localizedDescription],[parseError localizedFailureReason],[parseError localizedRecoverySuggestion],
[[parseError userInfo] objectForKey:NSErrorFailingURLStringKey]);
NSLog(@"\n------------------");
}
[parseError release];
//[parserObject release];
}
}
}
it is showing leak peak.when i click on there it will show me leaked blocks
and it will go to
receivedData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&connectionError];
this line of code in my app.
so how to release memory occupied by this.im releasing receivedData in my dealloc funcn,but still there is leak so how to solve it.
in my app ,i am parsing xml files using NSXMLParser.to connect to url we are making use of NSURLConnection.we are using synchronous connection.this will return NSData type. In performance tool i am checking for leaks.
- (void)parseXMLFileAtURL
{
theRequest=[NSURLRequest requestWithURL:URL];
NSError *connectionError= nil;
receivedData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&connectionError];
NSLog(@"\n\n---------Succeeded! Received %d bytes of data",[receivedData length]);
if([receivedData length] != 0)
{
//catalogObj = [Catalog getCatalogObject];
@try
{
parserObject = [[NSXMLParser alloc] initWithData:receivedData];
//receivedData = nil;
//theRequest = nil;
//response = nil;
}
@catch (NSException *e)
{
NSLog(@"ERROR : Name: %@\nReason: %@\n\n",e.name,e.reason);
}
[self.parserObject setDelegate:self];
[self.parserObject setShouldProcessNamespaces:NO];
[self.parserObject setShouldReportNamespacePrefixes:NO];
[self.parserObject setShouldResolveExternalEntities:NO];
@try
{
[self.parserObject parse];
}
@catch (NSException * e)
{
NSLog(@"ERROR : Name: %@\nReason: %@\n\n",e.name,e.reason);
}
@finally
{
NSError *parseError = [self.parserObject parserError];
if (parseError)
{
NSLog(@"\n------------------");
NSLog(@"\nPARSE ERROR OCCURED.....\nDescription: %@\nReason: %@\nSuggestion: %@\nInfo: %@\n\n",[parseError localizedDescription],[parseError localizedFailureReason],[parseError localizedRecoverySuggestion],
[[parseError userInfo] objectForKey:NSErrorFailingURLStringKey]);
NSLog(@"\n------------------");
}
[parseError release];
//[parserObject release];
}
}
}
it is showing leak peak.when i click on there it will show me leaked blocks
and it will go to
receivedData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&connectionError];
this line of code in my app.
so how to release memory occupied by this.im releasing receivedData in my dealloc funcn,but still there is leak so how to solve it.