iOS - CGImageRef Potential Leak -
i have code:
cgimageref imageref = cgimagecreatewithimageinrect([image cgimage], rect); uiimage *outputimage = [uiimage imagewithcgimage:imageref scale:image.scale orientation:uiimageorientationup];
and warning:
object leaked: object allocated , stored 'imageref' not referenced later in execution path , has retain count of +1
but using arc , cannot use release
or autorelease
. how resolve this?
just add code
cgimagerelease(imageref);
from cgimagecreatewithimageinrect
document,
the resulting image retains reference original image, means may release original image after calling function.
so,what need call cgimagerelease
make retain count -1
Comments
Post a Comment