UIImage from NSDocumentDirectory leaking memory
Posted
by Emil
on Stack Overflow
See other posts from Stack Overflow
or by Emil
Published on 2010-06-01T19:13:04Z
Indexed on
2010/06/01
19:13 UTC
Read the original article
Hit count: 394
Hey.
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.
© Stack Overflow or respective owner