How to solve the leaks when allocating the NSMutableArray in Objective-C

Posted by Madan Mohan on Stack Overflow See other posts from Stack Overflow or by Madan Mohan
Published on 2010-05-24T10:53:19Z Indexed on 2010/05/24 11:11 UTC
Read the original article Hit count: 224

Hi Guys,

I am getting leaks in Master view controller of iPhone.

When I call this method, I am inserting them into filteredListCount array, because when I search I need to show the list from filteredListCount array otherwise customerArray.

This functionality is working fine but I am getting leaks in the method below at allocation: filteredListCount = [[NSMutableArray alloc] initWithCapacity: [customerArray count]];

This is the first view controller of my application, I am showing the list and I am also allowing to search from a list.

- (void)parser:(CustomerListLibXmlParser *)parser addCustomerObject:(Customer *)customerObj1
{

 [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
 [customerArray addObject:customerObj1];
 filteredListCount = [[NSMutableArray alloc] initWithCapacity: [customerArray count]];
 [filteredListCount addObjectsFromArray: customerArray];
 [theTableView reloadData];
}

- (void)parser:(CustomerListLibXmlParser *)parser encounteredError:(NSError *)error
{

}
- (void)parserFinished:(CustomerListLibXmlParser *)parser
{
 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
 self.title=@"Customers";
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c