imageWithCGImage and memory

Posted by Adam Ernst on Stack Overflow See other posts from Stack Overflow or by Adam Ernst
Published on 2009-09-09T21:16:15Z Indexed on 2010/05/01 10:17 UTC
Read the original article Hit count: 382

Filed under:
|

If I use [UIImage imageWithCGImage:], passing in a CGImageRef, do I then release the CGImageRef or does UIImage take care of this itself when it is deallocated?

The documentation isn't entirely clear. It says "This method does not cache the image object."

Originally I called CGImageRelease on the CGImageRef after passing it to imageWithCGImage:, but that caused a malloc_error_break warning in the Simulator claiming a double-free was occurring.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about core-graphics