imageWithCGImage and memory

前端 未结 8 406
既然无缘
既然无缘 2020-12-10 02:24

If I use [UIImage imageWithCGImage:], passing in a CGImageRef, do I then release the CGImageRef or does UIImage take care of this itse

8条回答
  •  离开以前
    2020-12-10 02:51

    <> 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.

提交回复
热议问题