>> That'll need to be updated.  If you look at the @autoreleasepool section of 
>> the ARC documentation, it specifically states that crossing out of one via 
>> an exception will not drain the pool.  There doesn't appear to be any way, 
>> even through compiler flags, to change this.
> 
> If an autorelease pool pop is skipped by an exception, then the autorelease 
> pool will not be drained immediately. However, it will generally be drained 
> later, after the exception is caught and handled and some parent pool itself 
> is drained normally.

"Generally"?  In any case, could you see that the ARC documentation is updated 
- it says nothing about this; in fact it clearly states the behaviour I noted.

Also, now that I look at it again closely, the older documentation on 
autorelease pools and exceptions doesn't make sense.

> If an exception occurs, and the thread suddenly transfers out of the current 
> context, the pool associated with that context is drained. However, if that 
> pool is not the top pool on the thread’s stack, all the pools above the 
> drained pool are also drained (releasing all their objects in the process)

Isn't the autorelease pool "of the current context" by definition the topmost 
one?  If the exception takes you out of several autorelease-pool contexts then 
of course based on the first sentence you would expect all of them to be 
drained.  Which I gather is the behaviour.  So the second sentence (in fact, 
most of the rest of that paragraph in the docs) is very confusing.

Also, I don't understand the last bit of:

> Neither is it necessary or even desirable for an exception handler to send 
> release to its autorelease pool, unless the handler is re-raising the 
> exception.

How does re-raising the exception change the autorelease pool behaviour?  If I 
don't release the pool explicitly when re-raising an exception, does that mean 
the pool is 'leaked'?_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to