gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weak references & GC


From: Frederic De Jaeger
Subject: Re: Weak references & GC
Date: 19 Feb 2003 11:15:57 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi,

I don't fully agree with the fact that the system should remove dead
objects from the list of observers.  In my opinion, any program that
relies on this fact is not well designed.  The reason is that an
object that is not in the  graph of living objects should not
receive any notification, wether it has been collected or not.  

Collection occurs non deterministically.  It looks strange to me that
some notifications would be sent or not, depending on what the GC is
doing.  And I cannot imagine what is the meaning of a zombie object
(someone that is waiting to be collected) receiving a notification.

IMHO, being an observer is a resource that needs to be free
explicitely, when it is not needed anymore.  And this applies to all
kind of resources (except memory, that is handled by the GC) like
files, sockets, windows...

In such situation where is cannot be avoided, it is always possible to
"removeObserver:"  in a "gcFinalize" method (but I'm sure you already
know this) 

Cheers,

  Frederic De Jaeger




reply via email to

[Prev in Thread] Current Thread [Next in Thread]