If I CFRelease() an image in core data, how do I get it back?

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-06-13T21:22:29Z Indexed on 2010/06/13 21:42 UTC
Read the original article Hit count: 230

My iphone app plays a slide show made up of 5 user images.  These images are stored using core data.  I was noticing that memory was building up every time a different slide show was played and it was not releasing any of the previously played slide shows.   These images are showing up in Object Allocations as CFData. So I tried releasing this data in the dealloc method

CFRelease(slideshow.image1);
CFRelease(slideshow.image2);
CFRelease(slideshow.image3);
CFRelease(slideshow.image4);
CFRelease(slideshow.image5);

This releases the previous slideshow great...BUT when I go back to view that same slideshow again, it crashes.   I am guessing that I need to alloc/init these images again, but I am not sure how?  Or maybe I should be managing this memory in a different way?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management