garbage collection / cyclic references

andrew cooke andrew at acooke.org
Sat Mar 21 10:50:50 EDT 2009


Aaron Brady wrote:
> On Mar 21, 7:54 am, "andrew cooke" <and... at acooke.org> wrote:
>> they should not be used to do things like flushing and closing
>> files, for example.
> What is your basis for this claim, if it's not the mere unreliability
> of finalization?  IOW, are you not merely begging the question?

I'm not sure it's clear, but I was talking about Java.

As Paul implied, a consequence of completely automated garbage management
is that it is (from a programmer's POV) deterministic.  So it's a
programming error to rely on the finalizer to free resources that don't
follow that model (ie any resource that's anything other that reasonable
amounts of memory).

That's pretty much an unavoidable consequence of fully automated garbage
collection.  You can pretend it's not, and try using finalizers for other
work if you want.  That's fine - it's your code, not mine.  I'm just
explaining how life is.

Andrew





More information about the Python-list mailing list