uh... reference counting for class loader, interesting.

One thing could you help to clarify: how can the classloader know
there is class (loaded by it) that has surviving objects? We need
trace the object header to find the class then to find the classloader
and then to mark the classloader? Is this virtually the same as the
solution #1?

Thanks,
xiaofeng

On 10/29/06, Etienne Gagnon <[EMAIL PROTECTED]> wrote:
I have missed some messages of this thread, yet I do not remember seeing
a discussion of what seems to me the obvious solution to the problem.
So, here it is.

Why don't you simply add a reference count on classes which is
incremented on object allocation and decremented on object reclamation?
 [In case you use a copying collector, you could keep a separate count
(in the class) for the collected area, so that you only have to count
copied objects].  You would also use reference counting for the class
loader (therefore eliminating any cyclic problem that you could have
with normal garbage collection).  This would work very well as unloading
only happens when the class loader can be unloaded along all of its classes.

No need for any supportive information in object header, or anything
complex...  Am I really missing something?

Just an idea...

Etienne


--
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/



Reply via email to