imageWithCGImage and memory

前端 未结 8 403
既然无缘
既然无缘 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 03:10

    I have the same problem in XCode 3.2.1 on Snow Leopard. I have pretty much the same code as Jason.

    I have looked at the iPhone sample code which uses imageWithCGImage and they always release the CGImageRef using CGImageRelease after a call to imageWithCGImage.

    So, is this a bug in the simulator? I always get the malloc_error_break warning on the console when I use CGImageRelease.

    0 讨论(0)
  • 2020-12-10 03:13
    "This method does not cache the image object."
    

    So the UIImage take the ownership, and thus you should not release the CGImageRef.

    0 讨论(0)
提交回复
热议问题