首页 > 移动平台 > 详细

iOS-使用VPImageCropper时Analyze 出现Potential leak of an object stored into 'subImageRef'

时间:2015-04-22 18:26:59      阅读:261      评论:0      收藏:0      [点我收藏+]

技术分享

今天analyze的时候出现这个问题,是用的一个第三方裁剪图片的类叫VPImageCropper,结果发现他里面有问题,看图大家就明白了.在调用CGImageCreateWithImageInRect时subImageRef内存计数+1了,但是在后面用完后却没release.

那么问题来了,这个VPImageCropper是支持ARC的,也就是说系统遇到这边就不好用了,释放不了.这样就会有内存泄露

后来上 stackoverflow 查找 发现这样一段话

ARC does not manage C-types, of which CGImage may be considered. You must release the ref manually when you are finished with CGImageRelease(image);

也就是 在arc模式下 不是什么东西 都可以释放 例如 C-types的对象 都需要手动来进行释放 

加上这句话就好了CGImageRelease(subImageRef)

这时我们再来看下,问题解决了~

技术分享


iOS-使用VPImageCropper时Analyze 出现Potential leak of an object stored into 'subImageRef'

原文:http://blog.csdn.net/xutianyu930818/article/details/45195851

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!