NSCFArray leak in the NSMutablearray allocation
Posted
by Srilakshmi Manthena
on Stack Overflow
See other posts from Stack Overflow
or by Srilakshmi Manthena
Published on 2010-03-23T06:47:11Z
Indexed on
2010/03/23
6:53 UTC
Read the original article
Hit count: 291
objective-c
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]; }
© Stack Overflow or respective owner