Re: Observing with GC
Re: Observing with GC
- Subject: Re: Observing with GC
- From: Quincey Morris <email@hidden>
- Date: Tue, 26 Feb 2008 09:59:45 -0800
On Feb 26, 2008, at 02:42, Chris Suter wrote:
The observation info uses a weak reference and it will have been
zeroed before finalize is called so neither of the above are a
problem. Even so, I'm not sure it's a good idea to call
removeObserver: from the finalize method.
A weak reference to what? If you mean to the observed object, that
brings us full circle. My original question was whether the references
to observed objects are weak, and the answer I got was no.
Knowing this, you might wonder if you have to call removeObserver at
all in the GC case. I just ran some tests and it looks like you do
otherwise you'll get a memory leak which is a shame because it would
be easy to clean up automatically.
Do you know what's leaking? Are we talking about an observation info
object that's sitting there with a zeroed reference to the observee?
If so, I agree it's a shame, but I'm not sure how easy it would be for
the observation code to detect without a lot of scanning.
_______________________________________________
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