Re: class gc

Date view Thread view Subject view Author view

From: Alexandre Oliva (oliva@dcc.unicamp.br)
Date: Thu Dec 17 1998 - 15:52:28 EST


On Dec 17, 1998, Godmar Back <gback@cs.utah.edu> wrote:

>> It's still listed in the documentation of JDK 1.2.

> Where?

In the main docs/index.html, there's a link to it.

> My info is from here:
> http://java.sun.com/docs/books/jls/class-finalization-rationale.html

Hmm, good news.

>> > As for threads, all functions can actually deal with destroyed threads
>> > because that's exactly the state that they're in before they're started.
>>
>> Good. But how about File*Streams?

BTW, not that good, actually. What if the thread finalizer() starts
the thread: and then the thread quasi-finalizer releases its
resources? Or, even if the quasi-finalizer runs first, so that it
won't crash, if finalizer() starts() the thread, the thread stack
won't be released after that, because the second finalizer won't be
run.

Possible solution: ensure, in the thread actual finalizer, that the
thread isn't running, and, if it is, arrange that the finalizerObject
is replaced with a new object, to make sure that there will be another
round of finalization later.

> Same there, actually --- fd is set to -1.

Same there.

> So it does keep them alive since the class entry pool is not walked.

> Tell me why it should.

For the same reason why classes loaded by the default class loader
shouldn't be collected: people assume that static initializers will be
run only once. Making a difference based on whether a class was
loaded by the default class loader or another ClassLoader is not
right, IMO.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:20 EDT