send -release或-drain到Autorelease Pool有什么区别? [英] What's the difference between sending -release or -drain to an Autorelease Pool?
问题描述
在许多书籍和许多网站上,我看到了-drain。那么,对于一个声音酷的Autorelease池。但它除了发布之外做什么?我会猜测-drain只是使池释放它的所有对象,而不释放池本身。注意,对oxigen的回答说,-drain不释放NSAutoreleasePool是不正确的注释。
<垃圾收集系统。
In many Books and on many Sites I see -drain. Well, for an Autorelease Pool that sounds cool. But does it do anything other than an release? I would guess -drain just makes the Pool to -release all it's objects, without releasing the Pool itself. Just a guess.
Note that the comments on oxigen's answer saying that -drain does not release the NSAutoreleasePool are not correct. The documentation for NSAutoreleasePool clearly says that -drain releases (and thus destroys) the NSAutoreleasePool.
-drain is a replacement for using -release for NSAutoreleasePool objects, the only difference being that provides a hint to the garbage collection system.
这篇关于send -release或-drain到Autorelease Pool有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!