I am having serious issues with memory when loading images to table view cells. What is the proper way to use autoreleasepool
to correct the issue? I have tried:
for i in 0 ..< 5 {
autoreleasepool {
for j in 0 ..< 1000 {
image = UIImage(data: data)
dispatch_async(dispatch_get_main_queue(), {
if let cellToUpdate = tableView.cellForRowAtIndexPath(indexPath) {
// cellToUpdate.imageView?.image = image
cell.imageView!.image = image
}
})
}
}
}