ios - CGContextDrawPDFPage memory leak -
hello here code drawing pdf in catiledlayer
- (void)drawlayer:(calayer *)layer incontext:(cgcontextref)ctx { cgcontextsetrgbfillcolor(ctx, 1.0, 1.0, 1.0, 1.0); cgcontextfillrect(ctx, cgcontextgetclipboundingbox(ctx)); cgcontexttranslatectm(ctx, 0.0, layer.bounds.size.height); cgcontextscalectm(ctx, 1.0, -1.0); cgcontextconcatctm(ctx, cgpdfpagegetdrawingtransform(mypageref, kcgpdfcropbox, layer.bounds, 0, true)); cgcontextdrawpdfpage(ctx, mypageref); }
all got memory leak warning in following line
cgcontextdrawpdfpage(ctx, mypageref);
here mypageref cgpdfpageref
i had download code github , make r&d , found that,
i forgot release cgpdfpagerelease(mypageref)
in dealloc
method of tiledview..
and after writing code memory leak solved....
// clean up. - (void)dealloc { cgpdfpagerelease(mypageref); [super dealloc]; }
Comments
Post a Comment