[gclist] A Java question.

DickH dickh@pipeline.com
Sat, 29 Mar 1997 22:29:13 -0600

Bryan O'Sullivan wrote:
> m> All Java VM's must call finalizers and all as far as I know do.
> This is a potentially misleading statement, and should not be read to
> imply that an object's finalizer will always be called when it is
> garbage collected.

a finalize() method, if it exists, will be called _before_ the object is
garbage collected, 
and will only be called once by the GC (built-in) algorithm.  The only
way a finalize() method will 
be called more than once is if you explicitly call the finalize() method
yourself from Java source. 
And if you do, this has no bearing on the eventual invocation caused by
the normal GC built-in mechanism
which will also invoke finalize() exactly once [more]. 

Dick   www.machj.com  A Clean Room Java Virtual Machine.

> m> I think you may be talking about the fact that once a finalizer has
> m> been called once, it will not be called again.
> A finalizer may be called more than once in some circumstances.
>         <b

http://www.machj.com	Mach J, a clean room Java Virtual Machine