NSCFArray leak in the NSMutablearray allocation
- by Srilakshmi Manthena
Hi,
I am getting the leak at this allocation
filteredListContent = [[NSMutableArray alloc] initWithCapacity: [showList count]];
CODE:
-(void)reloadTable
{
EventListAppDelegate *appDelegate = (EventListAppDelegate *)[[UIApplication sharedApplication] delegate];
contactList = [appDelegate getAllContactsList];
inviteeList = [appDelegate getInviteeListForEvent:event.primaryKey];
if (isInvited == YES)
{
showList=[appDelegate getInviteeListForEvent:event.primaryKey];
}
else
{
showList =[appDelegate getAllContactsList];
}
filteredListContent = [[NSMutableArray alloc] initWithCapacity: [showList count]];
[filteredListContent addObjectsFromArray: showList];
[self organizeContactItemsIntoIndexes];
self.title = [event.name capitalizedString];
[self getToolbar];
[theTableView reloadData];
}
(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
[filteredListContent removeAllObjects];
ContactDTO *currentElement;
NSRange range;
for (currentElement in showList)
{
range = [currentElement.lastName rangeOfString:searchText options:NSCaseInsensitiveSearch];
if(range.location==0)
{
[filteredListContent addObject:currentElement];
}
}
[self organizeContactItemsIntoIndexes];
[theTableView reloadData];
}
(void)dealloc {
[filteredListContent release];
[super dealloc];
}