Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@autoreleasepool semantics

Tags:

I was reading the ARC docs on the llvm site: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

..in particular about @autoreleasepool.

In lot of current implementation using NSAutoreleasePool, I see cases where the pool is drained periodically during a loop iteration - how do we do the same with @autorelease pool, or is it all done for us somehow under the hood?

Secondly, the docs state that if an exception is thrown, the pool isn't drained.... ok exceptions are by name exceptional, but if they do happen, you might like to recover without leaking a load of memory. The docs don't specify when these objects will be released.

Anyone got any info about these points?