gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAutoreleasePool drain/dealloc


From: Ivan Vučica
Subject: Re: NSAutoreleasePool drain/dealloc
Date: Tue, 6 Mar 2018 17:27:25 +0000


On Tue, Mar 6, 2018 at 5:24 PM, Richard Frith-Macdonald <address@hidden> wrote:


According to Apple, the -drain method is a synonym for -release (or -dealloc since you don't retain autorelease pools).
So yes, if youi drain a pool the next time an object is autoreleased it goes into the parent pool of the one you drained.
Your code above should crash at the point where you call [innerPool release] since you are sending the -release message to a deallocated object.

Thank you! I guess I never read that part of the NSAutoreleasePool docs.
 
I think the -drain method name is unintuitive.  To me it sounds like it ought to do the same as the gnustep-specific -emptyPool method (a more efficient equivalent to draining/releasing the pool and immediately creating a new one).

That's what I assumed it was doing: releasing the members of the pool, while not releasing the pool itself.

Thank you!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]