ios - "Potential leak of an object" when using Core Graphics -
my app drawing shadow using following code:
-(void)drawshadow:(cgcontextref)context rect:(cgrect)rect{ cgcontextsavegstate(context); //set color of current context [[uicolor blackcolor] set]; //set shadow , color of shadow cgcontextsetshadowwithcolor(context, cgsizemake(0, 2), 3, [[uicolor colorwithwhite:0 alpha:0.5] cgcolor]); cgcontextfillellipseinrect(context, rect); cgcontextcliptomask(context, rect, cgbitmapcontextcreateimage(context)); cgcontextrestoregstate(context); // warning shows in line }
when run product > analyze, marks last instruction of block message: "potential leak of object". when remove line, shows same message in closing bracket.
any idea of i'm doing wrong?
thanks
i think it's cgbitmapcontextcreateimage
leaking.
try assigning local variable , calling cgimagerelease
once you've clipped mask.
Comments
Post a Comment