What's the difference between sending -release or -drain to an Autorelease Pool?

后端 未结 3 2046
渐次进展
渐次进展 2020-12-10 11:06

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

3条回答
  •  庸人自扰
    2020-12-10 11:53

    Oxigen is right, see the documentation for method drain of NSAutoreleasePool:

    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.

提交回复
热议问题