• 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: How to completely release every object allocated when opening a NIB file ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to completely release every object allocated when opening a NIB file ?


  • Subject: Re: How to completely release every object allocated when opening a NIB file ?
  • From: Allan Odgaard <email@hidden>
  • Date: Wed, 14 Jan 2004 06:44:02 +0100

On Jan 13, 2004, at 8:12 PM, Charles Srstka wrote:

For other more complex situations: If your nib file is controlled by a window controller, as is recommended, it takes care of memory management for you [...]

Actually, there is one subtlety here. Let us place an ivar in our window controller named 'title' and in the controlled Nib, we put a text field which we bind to "File's Owner" with model key set to 'title', a rather trivial setup I would think.

But, because the text field is bound to File's Owner (i.e. our window controller), it will retain it. So our window controller will have a retain count of two (one because we alloc/init'ed it and another because the text field retains it).

So when we are done with the controller, we may release it, but nothing will happen, because it will not dispose of the nib before it reaches a retain count of zero, which it never will, because objects in the Nib retains it -- i.e. a cycle.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: How to completely release every object allocated when opening a NIB file ? (From: Charles Srstka <email@hidden>)
 >Re: How to completely release every object allocated when opening a NIB file ? (From: j o a r <email@hidden>)
 >Re: How to completely release every object allocated when opening a NIB file ? (From: Charles Srstka <email@hidden>)
 >Re: How to completely release every object allocated when opening a NIB file ? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by Date: Re: How to completely release every object allocated when opening a NIB file ?
  • Previous by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Index(es):
    • Date
    • Thread