suzuki611 at okisoft.co.jp
Tue Jun 1 12:40:17 CEST 1999
In article <7iv86a$iud at news.dns.microsoft.com>,
"Vadim Chugunov" <chega_ at yahoo.com> wrote:
> Right, but java finalizers will not be called till the moment the memory is
> Depending on the GC configuration and the program's memory consumption this
> may be quite a while.
You are right. The JLS (Java Language Specification) says:
The Java language does not specify how soon a finalizer
will be invoked, except to say that it will happen before
the storage for the object is reused. (sect.12.6)
In fact, there is no guarantee that all garbages will be reused,
up to their last one byte, within the life time of the java
process, and there is also no guarantee that ALL finalizers will
be eventually invoked. It is an issue of the quality of JVM
implementation, you know.
> Can you explain exactly why is it more error prone?
> If something can be done automatically, without writing explicit
> deallocation code,
> why can't we let it be that way?
Perhaps it is safe to say that destructors with real GC are more
error prone. (The present Python is safer in this respect!)
In general, real GC simulates infinite memory virtually, and one
should not rely on finalizers; objects remain virtually forever.
With real GC, finalizers should be used only as the last resort.
BTW, Mr. Matz has invented and implemented his excellent
language, Ruby, which is a sort of Perl's successor with some
intrinsic object-oriented features. IMHO, we must have respect
for his opinion as such or, at the very least, as the evangelist
of his own language. See http://www.netlab.co.jp/ruby/
--===-----========------------- Sana esprimo naskas sanan ideon.
SUZUKI Hisao suzuki611 at okisoft.co.jp, suzuki at acm.org.
More information about the Python-list