I currently have this code:
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingPathComponent:[NSString stringWithFormat:@"/%@.png", [postsArrayID objectAtIndex:indexPath.row]]]];
It’s loading in an image to set in a UITableViewCell. This obviously leaks a lot of memory (I do release it, two lines down after setting the cells image to be that image), and I’m not sure if it caches the image at all.
Is there another way, that doesen’t leak so much, I can use to load in images multiple times, like in a tableView, from the Documents-directory of my app? Thanks.
The
leakstool or Instruments should tell you what exactly is leaking. However, theimageandimageViewproperties retain their images, so you may need to ensure you’re properly releasing them in thedeallocmethod for the UITableViewCell. But like AngeDeLaMort said, we really need more information to give you a precise answer.