• 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: Use of weak reference in non-circular reference situation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of weak reference in non-circular reference situation


  • Subject: Re: Use of weak reference in non-circular reference situation
  • From: Eric <email@hidden>
  • Date: Wed, 31 May 2006 11:58:41 -0700

Yes, aArray doesn't care whether A is retained or even the fact that it's
retained by A.  But I'm just saying that in this particular example, the
programmer knows and assumes aArray will be around as long as A exists in
memory, and therefore it's safe to have aObject be a weak reference to
aArray (since aObject is an ivar of A and will only be used when A exists in
memory).  It's just assumption in a special case, not a general case.

On 5/31/06, John C. Randolph <email@hidden> wrote:


On May 31, 2006, at 3:14 AM, Eric wrote:

>  Since aArray is not
> deallocated until Object A is deallocated,


It's not clear why "aArray" should know or care whether A is deallocated. The usual semantics are that an NSArray retains its contents, and releases them when they're removed or the array itself is deallocated. Whether anything else has retained A shouldn't matter to "aArray" at all.

-jcr


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Use of weak reference in non-circular reference situation (From: Eric <email@hidden>)
 >Re: Use of weak reference in non-circular reference situation (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: [OBJC newbie] - Intance variable becomes 'invalid'
  • Next by Date: Re: [OBJC newbie] - Intance variable becomes 'invalid'
  • Previous by thread: Re: Use of weak reference in non-circular reference situation
  • Next by thread: Re: Use of weak reference in non-circular reference situation
  • Index(es):
    • Date
    • Thread