> On Jul 14, 2017, at 10:09 AM, Jeremy Hughes <moon.rab...@virginmedia.com> > wrote: > >> On 14 Jul 2017, at 14:40, Steve Christensen <puns...@mac.com >> <mailto:puns...@mac.com>> wrote: >> >> On Jul 14, 2017, at 3:50 AM, Jeremy Hughes <moon.rab...@virginmedia.com >> <mailto:moon.rab...@virginmedia.com>> wrote: >>> >>> I’m still not entirely clear on when autorelease pools are used in Swift. >>> There is a WWDC video which says that they’re used in code that interfaces >>> with Objective-C, but Greg Parker’s comments in this thread indicate that >>> autorelease is also used behind the scenes in native Swift code - except >>> that in many cases the compiler is able to optimise it out of existence. >>> Apple’s Swift book doesn’t mention autorelease. >> >> I think the hazard here is that you are trying to build a mental model of >> when to expect autorelease pools (or autorelease behavior in general) and >> when not to. Worse, that you might design your code to fit those >> expectations. > > Apple’s documentation states that there are times that you do want to > consider the memory effects of autorelease pools (and suggests adding your > own pools to prevent large accumulations of dead objects during loops) - so > knowing when they are used isn’t irrelevant. > > Also, ARC is described as “deterministic” - which I’m possibly > misinterpreting as meaning "behaves in a predictable way". > > Jeremy
I’d interpret it as “behaves in a consistent way.” Predictable is subjective, especially when autorelease pools are involved. Charles _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com