objective-c – ARC是否会为您释放内存错误?

前端之家收集整理的这篇文章主要介绍了objective-c – ARC是否会为您释放内存错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
自动引用计数释放已分配的Objective-C对象.原始变量如char *?

解决方法

不是 llvm document on ARC

Automatic Reference Counting implements automatic memory management for Objective-C objects and blocks,freeing the programmer from the need explicitly insert retains and releases. It does not provide a cycle collector; users must explicitly manage lifetime instead.

A retainable object pointer (or retainable pointer) is a value of a retainable object pointer type (retainable type). There are three kinds of retainable object pointer types:

  • block pointers (formed by applying the caret (^) declarator sigil to a function type)
  • Objective-C object pointers (id,Class,NSFoo*,etc.)
  • typedefs marked with __attribute__((NSObject))

Other pointer types,such as int* and CFStringRef,are not subject to ARC’s semantics and restrictions.

原文链接:https://www.f2er.com/c/113087.html

猜你在找的C&C++相关文章