リファレンスの drainの説明。
NSAutoreleasePool Class Reference より抜粋:
In a reference-counted environment, releases and pops the receiver; in a garbage-collected environment, triggers garbage collection if the memory allocated since the last collection is greater than the current threshold.
(ガベージコレクションを使わない iOS4 などの)reference-countな環境では両者は同じ動作をするとある。
Memory Management Programming Guide: Autorelease Pools の Garbage Collection でも同様の記述。
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
参考情報など。
How does the NSAutoreleasePool autorelease pool work? - Stack Overflow
What's the difference between sending -release or -drain to an Autorelease Pool? - Stack Overflow
- - - -
releaseとdrain でメモリ解放の仕方に違いが出たケースを見たのだが原因がわからず。
Responses
Leave a Response