Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 23 06:00:50 EST 2002


Erik Max Francis wrote:
> The difference here is that for the de facto language specification to
> change the finalization behavior from unspecified to that of CPython's
> and only CPython's would mean they'd have to declare Jython not really a
> Python implementation.  That seems, to say the least, a lot more
> unlikely.

It *is* difficult to predict the future. Jython may become irrelevant, 
or Java may grow an extension to invoke finalizers as soon as the object 
becomes unreachable.

> The whole "even CPython could change" subtext was an utterly trivial,
> theoretical point that has been blown way out of proportion.

But what, if CPython doesn't change, is the problem with relying on its 
implementation details? The application may not work the same way on 
Jython. Perhaps this is the case even without relying on refcounting to 
close files, or perhaps it is irrelevant whether this application runs 
on Jython, as it is meant to be shipped as a frozen HP-UX binary.

> What I was saying is that you need to safeguard external critical
> resource acquisition and release with something more stringent than
> relying on finalization, and that is because the Python documentation
> even says so.  That is all.

I completely understand, and I think you are wrong. You don't need 
further safeguards; the ones you have are sufficient, atleast for some 
(the majority?) of the application.

Regards,
Martin




More information about the Python-list mailing list