开发者

difference between drain and release

开发者 https://www.devze.com 2023-02-09 23:15 出处:网络
i want to know the difference between drain a开发者_如何学运维nd release in memory management..please help me with suitable example.

i want to know the difference between drain a开发者_如何学运维nd release in memory management..please help me with suitable example.


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.

Source: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html

0

精彩评论

暂无评论...
验证码 换一张
取 消