【pool drain】和【pool release】区别

在引用计数方式下,二者没有什么不同,你通常要使用drain
在GC(garbage-collected)环境下,drain会在必要时引起GC作用,然而release是个空操作。
http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/doc/uid/20000051-SW5
In a garbage-collected environment, there is no need for autorelease pools. You may, however, write a framework that is designed to work in both a garbage-collected and reference-counted environment. In this case, you can use autorelease pools to hint to the collector that collection may be appropriate. In a garbage-collected environment, sending a drain message to a pool triggers garbage collection if necessary; release, however, is a no-op. In a reference-counted environment, drain has the same effect as release. Typically, therefore, you should use drain instead of release.

posted @ 2012-12-13 01:12  白条围巾  阅读(1550)  评论(0编辑  收藏  举报