Re: How to completely release every object allocated when opening a NIB file ?
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.