NSAutoreleasePool的release和drain的区别
2013-03-12 17:19
316 查看
关于NSAutoreleasePool的release和drain的区别
苹果官方文档的翻译
In a garbage collected environment, release is a no-op. NSAutoreleasePool therefore provides a drain method that in a reference-counted environment behaves the same as calling release, but which in a garbage
collected environment triggers garbage collection (if the memory allocated since the last collection is greater than the current threshold). Typically, therefore, you should use drain rather than release to dispose of an autorelease pool.
在一个garbage collected环境里,release不做任何操作。 NSAutoreleasePool因此提供了一个 drain 方法,它在reference-counted环境中的行为和调用release一样, 但是在一个garbage collected环境中则触发garbage collection动作 (if the memory allocated since the last collection
is greater than the current threshold)。 因此通常你应该使用drain而不是release去释放一个autorelease pool。
苹果官方文档的翻译
In a garbage collected environment, release is a no-op. NSAutoreleasePool therefore provides a drain method that in a reference-counted environment behaves the same as calling release, but which in a garbage
collected environment triggers garbage collection (if the memory allocated since the last collection is greater than the current threshold). Typically, therefore, you should use drain rather than release to dispose of an autorelease pool.
在一个garbage collected环境里,release不做任何操作。 NSAutoreleasePool因此提供了一个 drain 方法,它在reference-counted环境中的行为和调用release一样, 但是在一个garbage collected环境中则触发garbage collection动作 (if the memory allocated since the last collection
is greater than the current threshold)。 因此通常你应该使用drain而不是release去释放一个autorelease pool。
相关文章推荐
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- 关于 NSAutoreleasePool中 release 与 drain 区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoreleasePool 和 @autoreleasepool blocks 区别
- NSAutoreleasePool释放时为什么经常用drain,不用release
- auto release pool 应该用release还是drain
- NSAutoReleasePool 用法
- Xcode中使用NSAutoreleasePool报错的问题
- [面试题]自动释放池跟GC有什么区别?iPhone上有GC么?[pool release] 和[pool drain]有什么区别
- Object-C中的内存管理 MRC、ARC以及Autoreleasepool的区别
- NSAutoreleasePool初始化语句必须是第一条执行语句
- NSAutoreleasePool与autorelease 详解(一)
- ojbect-c中,NSAutoreleasePool