This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Array marking
- To: bryce at albatross dot co dot nz (Bryce McKinlay)
- Subject: Re: Array marking
- From: Godmar Back <gback at cs dot utah dot edu>
- Date: Mon, 1 May 2000 16:53:22 -0600 (MDT)
- Cc: gback at cs dot utah dot edu (Godmar Back), java-discuss at sourceware dot cygnus dot com
>
> Godmar Back wrote:
>
> > FWIW, there is no "class finalization" in Java. It has been removed
> > from the language spec quite some time ago.
>
> > Maybe you're talking about something else though?
>
> Yeah, I think Hans meant to say "ClassLoader finalization"
>
I have found it beneficial to distinguish between "Java" finalizers and
synchronously running "destructors" (as in C++ destructors).
The allocator or some other part of the run-time system should provide
both.
In my JVM, which is based on Kaffe, I support Java finalizers for Java
objects, but I practically never use them for VM-internal data structures,
such as classloaders or classes, or threads.
Instead, I use destructors to perform whatever actions are necessary before
freeing them. I think I'll incorporate that particular piece of code in
kaffe soon, it currently still uses finalizers in places; it took some time
to learn that lesson.
Conceptually, I've found it tremendously helpful not having to deal
with the vagaries of finalization and possible reattachment and all that
stuff and use such destructors instead.
Note that the destructors are invoked after an object has gone from
reachable to finalizable to finalized to unreachable; they're invoked
right before the actual free() or equivalent thereof.
- Godmar