GC and finalizers [was: No destructor]

Paul Duffin pduffin at hursley.ibm.com
Fri Sep 1 11:35:17 CEST 2000


Vladimir Marangozov wrote:
> 
> Paul Duffin wrote:
> >
> > The current solution to this of adding cycles which could not be cleaned
> > up to a global list does ensure that an application can find those
> > objects which could not be cleaned up but what is it supposed to do with
> > them ?
> 
> The current concensus is that if "it" refers to the collector, it should
> give up because no further automatic decision is sane. The collector is
> friendly enough in the sense that it publishes the list of these objects
> so that the user can see them in the first place. It is assumed that
> the code needs to be fixed subsequently so that such "unbreakable" cycles
> don't happen. This is a programmer's responsibility.
> The collector is best effort, but it's not insane <wink>.
> 

So how are these "unbreakable" cycles supposed to be prevented, the only
way that I can see is to remove finalizers from classes which may find
themselves in a cycle. The trouble with this is that the finalizers are
there for a purpose and it may not be possible to remove them. 

What can be done in this situation to prevent "unbreakable" cycles ?



More information about the Python-list mailing list