GC and finalizers [was: No destructor]

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Sep 5 11:58:58 EDT 2000


Michael Hudson <mwh21 at cam.ac.uk> writes:

> Well, the point is that there are situations in which the gc has no
> way of working out the order to finalise objects in (Is it really
> undecidable?  Maybe), so if you want to be certain to avoid these then
> you have two options:
> 
>   1) don't create cycles
>   2) don't use finalizers

With Python 2, I'd rather recommend 

    3) don't use finalizers on "recursive" objects, only use
       them on "atoms" (i.e. leafs of the object graph)

Regards,
Martin



More information about the Python-list mailing list