Re: Does NSNotificationCenter have zeroing weak references to observers ?
Re: Does NSNotificationCenter have zeroing weak references to observers ?
- Subject: Re: Does NSNotificationCenter have zeroing weak references to observers ?
- From: "Ken Ferry" <email@hidden>
- Date: Wed, 13 Aug 2008 20:28:18 -0700
Yep, it's true.
http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcFinalize.html
"in a garbage collected environment, notification centers use zeroing
weak references"
Please be aware that this isn't (yet?) true for Key-Value Observing.
-Ken
On Wed, Aug 13, 2008 at 8:22 PM, Erik Buck <email@hidden> wrote:
> Does NSNotificationCenter use zeroing weak references to observers ?
>
> I want to say "When using Cocoa's automated memory garbage collection,
> NSNotificationCenter automatically un-registers observers that are no longer
> in use somewhere else in the application." I'm just not sure it's true.
> Can anyone save me the time of writing a test application? In my test
> program, how can I tell the difference between an observer for which the
> NSNotificationCenter has a strong reference and an observer that is about to
> be finalized but hasn't been yet ? Is this the classic "halting problem?"
>
> _______________________________________________
>
> 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
>
_______________________________________________
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