So I have a table view that I am filling with custom table cells. The problem I am running into is it starts to slow down while scrolling when lots of items start filling the table. (I have implemented a dynamic scroll so as the user scrolls there is a method that goes out and fetches the next x items from the server so they can scroll to their heart’s content without refreshing/pressing anything.)
Now I am creating the cells from a custom template I built in IB and initialize them something like this:
CustomCellClass *cell = (CustomCellClass *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
cell = (CustomCellClass *)[nib objectAtIndex:0];
}
How should the memory management work in a case like this so I don’t end up taking huge gobs of memory and slowing the scroll down? Any help/suggestions/insight would be greatly appreciated. Thanks!
EDIT: I have checked for memory leaks so that shouldn’t be the issue.
So I discovered a deep rooted memory leak in one of my data controller classes that is used to fetch the data. THAT’s what was causing the slowdown. I saw the massive memory usage going on, but instruments wasn’t detecting a leak. Just goes to show nothing better then good old manual debugging. 🙂 Thanks for the help.