I am creating a very long table with images and some text data. I am using resuable cells. I am getting high memory allocations as I scroll the table 开发者_开发知识库down, may be due to new images loads and add to resuable cells.
I want to know is there a way to dispose the resuable cells when they are not in the view.
Please help!
You have no way to remove the reusable cells as this task is efficiently managed by the table view itself. According to me, but I need to see some code snippet to confirm, you're not disposing the images properly.
A typical case is when you load images using the -(UIImage *)imageNamed:
method and in such case all images are stored in a OS managed cache which is not as efficient as manual alloc/release.
Another case is when you create the cell and forget to autorelease it. This means that in the tableView:cellForRowAtIndexPath:
method when you instantiate the new UITableViewCell
you must autorelease it before leaving the method (it will be retained by UITableView
internal queue).
精彩评论