Re: Nib & retainCount confusion
Re: Nib & retainCount confusion
- Subject: Re: Nib & retainCount confusion
- From: Keary Suska <email@hidden>
- Date: Wed, 03 Oct 2007 09:39:40 -0600
- Thread-topic: Nib & retainCount confusion
on 10/3/07 1:05 AM, email@hidden purportedly said:
> I have a controller class that loads a nib. The Nib has an 1)
> NSObjectController and 2) a view. The view has controls which are
> bound to various properties in the NSObjectController. The
> NSObjectcontroller's content value is bound to my controller class'
> dictionary ivar. Whenever I send a release message to my controller
> class, I expect the dealloc method to be called. I overrode retain &
> release to see how many times the methods get called and under what
> cricumstances. It seems that whenever I call the release, the retain
> count is always at 2, so my dealloc method never gets called. This is
> a memory leak. Is my controller class being retained through bindings
> somehow? The same controls that the NSObjectController are bound to
> are also present in my controller class as IBOutlets. I set them to
> nil when I want to release the object. Ugh. Any thoughts on what I am
> doing wrong?
Your controller class is probably being implicitly retained by the binding.
If you are "manually" loading the nib, are you releasing the top level
objects dictionary first? Note also that if you are in some way avoiding the
main event loop (such as using a modal session), you may have to call the
event loop to clear the autorelease pool, with something like:
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:0.1]];
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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