[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSAutoreleasePool drain/dealloc
From: |
David Chisnall |
Subject: |
Re: NSAutoreleasePool drain/dealloc |
Date: |
Wed, 7 Mar 2018 06:55:50 +0000 |
On 6 Mar 2018, at 17:24, Richard Frith-Macdonald <address@hidden> wrote:
>
> 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).
-drain was introduced with GC, where -release was optimised away in either the
compiler or the runtime and never delivered. It allowed the GC implementation
to use autorelease pools as a hint that there were a lot of short-lived objects
to delete and have the same code work in non-GC mode. ARC fixed this a lot
better by introducing the @autoreleasepool syntax, and should be used in all
new code.
David