• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ARC dealloc best pratice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC dealloc best pratice


  • Subject: Re: ARC dealloc best pratice
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 06 Feb 2015 15:27:38 -0800

> On Feb 6, 2015, at 2:00 PM, Greg Parker <email@hidden> wrote:
>
> Swift adds "unowned" references. These references are non-retaining. They differ from weak references and unsafe unretained references: unowned references fail with a runtime error if you try to access the pointed-to object after it has been deallocated.
…
> They are cheaper than weak references and safer than unsafe-unretained.

What makes them cheaper than weak references? It sounds like they both have to do the same bookkeeping to track whether the pointed-to object is alive; the only difference is the behavior when accessing the reference after the pointed-to object is dealloced (i.e. treating the pointer as nil vs. failing with an error.) Both of those seem equivalent in complexity.

But maybe I'm off-base on how weak references are implemented… I'd love to see an explanation, actually.

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: ARC dealloc best pratice
      • From: Greg Parker <email@hidden>
References: 
 >ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jens Alfke <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jens Alfke <email@hidden>)
 >Re: ARC dealloc best pratice (From: Greg Parker <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Greg Parker <email@hidden>)

  • Prev by Date: [CIImageAccumulator image]: getting the BMP representation destroys the image contents
  • Next by Date: Re: ARC dealloc best pratice
  • Previous by thread: Re: ARC dealloc best pratice
  • Next by thread: Re: ARC dealloc best pratice
  • Index(es):
    • Date
    • Thread