• 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: Avoiding mutual retain cycles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding mutual retain cycles


  • Subject: Re: Avoiding mutual retain cycles
  • From: Andreas Mayer <email@hidden>
  • Date: Mon, 21 Jul 2008 21:21:43 +0200


Am 21.07.2008 um 20:50 Uhr schrieb Markus Spoettl:

I'm wondering if there is a general rule or mechanism that suggests what to do in such a case.

About retain cycles:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html

"The solution to the problem of retain cycles is that the “parent” object should retain its “children,” but that the children should not retain their parents."

For instance, how are delegates implemented in AppKit, are they retained?

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html

"Delegating objects do not (and should not) retain their delegates."

But there are still cases where it is unknown which of the objects is going to be released first

Care to name one?

I generally do not find it difficult to decide which object needs to own which. In case you can't decide, maybe neither should and you are better off adding a third object that handles both.


Andreas_______________________________________________

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: Avoiding mutual retain cycles
      • From: Markus Spoettl <email@hidden>
References: 
 >Avoiding mutual retain cycles (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: Design question, which controller class to use
  • Next by Date: Re: Growl, NSTimer, and Launching Application help!
  • Previous by thread: Avoiding mutual retain cycles
  • Next by thread: Re: Avoiding mutual retain cycles
  • Index(es):
    • Date
    • Thread