自动引用计数不会释放calloc

时间:2013-05-20 12:28:46

标签: iphone ios objective-c ipad automatic-ref-counting

当我在配置文件中运行应用程序时,我正在使用ARC in my application, for encoding the string i am using calloc`它在calloc上显示内存泄漏。

enter image description here

ARC是否会发布calloc

如果不是,为什么不发布以及如何发布calloc

谢谢,

1 个答案:

答案 0 :(得分:7)

不幸的是,ARC仅为objective-c对象管理内存,因此在您的情况下,您必须自己处理内存管理。

要“释放”calloced内存,您需要在不再使用时调用free

free(strResult);