[swift-users] Autoreleasepool for Ubuntu

Jens Alfke jens at mooseyard.com
Wed Nov 2 14:06:58 CDT 2016


> On Nov 2, 2016, at 09:42, Joe Groff via swift-users <swift-users at swift.org> wrote:
> 
> Autoreleasepools are an ObjC compatibility feature. They aren't necessary in standalone Swift.

So Swift’s ref-counting doesn’t use any autorelease mechanism? I was assuming it did (even if it’s not identical to Obj-C’s.) I implemented an ARC-like library for C++ back around 2007 and found that adding an autorelease pool helped by keeping object ref-counts from bouncing up and down so much during assignment and return value passing.


> On Nov 2, 2016, at 11:11 AM, Bernardo Breder via swift-users <swift-users at swift.org> wrote:
> 
> I want to manager the memory, using the autoreleasepool block, with ubuntu environment, as we can do with Xcode.

Apparently you don’t need to because pure Swift objects never get autoreleased, so there’s no pool that needs draining.

—Jens


More information about the swift-users mailing list