Does CGImageRelease() free UIImage's memory?

筅森魡賤 提交于 2019-12-08 06:52:46

问题


I have the following code:

UIImage *originalImage;
CGImageRef cgImage = [originalImage CGImage];

I know that CGImage is a read-only property of UIImage class. Does the line

CGImageRelease(cgImage)

free originalImage's memory?

I'm tracing down a bug in my program and this line seems to be a hot candidate if I'm trying to access originalImage later.

Thanks, Stefan


回答1:


I've found the answer myself: Because the call

CGImageRef img = [[UIImage imageNamed:@"pic.png"] CGImage];

does not contain one of the words create, copy or alloc, I am not responsible for freeing this memory.



来源:https://stackoverflow.com/questions/1428102/does-cgimagerelease-free-uiimages-memory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!