In the iPhone book by Erica Sadun there are several places where she uses the function createImage() to crate an image on the fly with some text or graphics.
Those functions usually end like this:
And on the web I found several similar functions, this one for example at iphonedevsdk.com!
So, is there a memory leak? Do they need to call CGImageRelease() before returning an UIImage instance?
Apple's documentation confuses everything with some other problem: CGBitmapContextCreateImage
Those functions usually end like this:
Code:
CGImageRef myRef = CGBitmapContextCreateImage (context);
free(CGBitmapContextGetData(context));
CGContextRelease(context);
return [UIImage imageWithCGImage:myRef];
And on the web I found several similar functions, this one for example at iphonedevsdk.com!
So, is there a memory leak? Do they need to call CGImageRelease() before returning an UIImage instance?
Code:
UIImage uiImage = [UIImage imageWithCGImage:myRef];
CGImageRelease (myRef);
return (uiImage);
Apple's documentation confuses everything with some other problem: CGBitmapContextCreateImage