问题描述
我是Xcode 4.2的新手,并且尚未完全了解ARC.但是,我确实读过@autoreleasepool代替了手动使用自动释放池,并且在引擎盖下做了一些特殊的魔术处理,以便与ARC配合使用.
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 special magic under the hood to play nice with ARC.
但是,当我在Xcode 4.2中专门启动了一个新项目,并且将ARC选项关闭了时,我仍然在模板代码中得到@autoreleasepool语句.
Yet, when I start a new project in Xcode 4.2 specifically with the ARC option turned off I still get @autoreleasepool statements in the template code.
这是怎么回事?
推荐答案
来自 http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool :
和格雷格·帕克(Greg Parker)说 [1] [2] :
and Greg Parker says [1] [2]:
因此您可以使用@autoreleasepool
而不考虑ARC,它在OS X v10.7 +和iOS 5.0+上将比NSAutoreleasePool
快.
So you may use @autoreleasepool
regardless of ARC, and it’ll be faster than NSAutoreleasePool
on OS X v10.7+ and iOS 5.0+.
这篇关于@autoreleasepool没有ARC吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!