Array marking
Godmar Back
gback@cs.utah.edu
Mon May 1 15:53:00 GMT 2000
>> 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
More information about the Java
mailing list