WHAT DO YOU MEAN BY AUTORELEASE POOL - DRAIN VS RELEASE

Nigel Bunyan

Total Post:4

Points:20
Posted by  Nigel Bunyan
 664  View(s)
Ratings:
Rate this:
  1. Nigel Bunyan

    Post:4

    Points:20
    What do you mean by Autorelease pool - Drain Vs Release

    In a reference-counted environment, drain does perform the same operations as release, so the two are in that sense equivalent. To emphasise, this means you do not leak a pool if you use drain rather than release.

     

    In a garbage-collected environment, release is a no-op. Thus it has no effect. drain, on the other hand, contains a hint to the collector that it should "collect if needed". Thus in a garbage-collected environment, using drain helps the system balance collection sweeps.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!