If I use [UIImage imageWithCGImage:]
, passing in a CGImageRef
, do I then release the CGImageRef
or does UIImage take care of this itse
<> Not my opinion. I had the same problem. According to documentation
UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];
imho keeps all references correct. If you are using a CGDataProvider please have a look at CGDataProviderReleaseDataCallback and set a breakpoint in your callback. You can see that is is correctly called after you [release] your image and you can free() your image data buffer there.