@autoreleasepool without ARC?

后端 未结 1 1194
死守一世寂寞
死守一世寂寞 2020-11-27 17:16

I\'m new to Xcode 4.2, and I\'m not yet fully up to speed on ARC. However, I did read that @autoreleasepool replaces the manual use of autorelease pools and does some specia

相关标签:
1条回答
  • 2020-11-27 17:32

    From http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool:

    @autoreleasepool may be used in non-ARC translation units, with equivalent semantics.

    and Greg Parker says [1] [2]:

    LLVM 3.0's @autoreleasepool { ... } is much faster than NSAutoreleasePool if your deployment target is new enough. No ARC required. (…) always works, but it's faster with deployment target of OS X 10.7 or iOS 5.0.

    So you may use @autoreleasepool regardless of ARC, and it’ll be faster than NSAutoreleasePool on OS X v10.7+ and iOS 5.0+.

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