Re[3]: [gclist] Finalization and object orientation.

Hans Boehm boehm@hoh.mti.sgi.com
Thu, 27 Mar 1997 22:19:25 -0800


Greg Colvin wrote:

> Right, except that Java's finalization call is not required to do anything 
> at all.

It would be hard to require it to do something precise without seriously
inhibiting optimization.  Certainly it could not require that unreachable
objects with finalize methods be finalized.  (Gosling, Joy, and Steele
define a reachable object to be one that "can be accessed in any potential
continuing computation from any live thread".  This is clearly undecidable
in general.)

Language definitions usually leave many properties related to resource
usage undefined.  Those are usually beyond the scope of the definition.
We have to be willing to assume that implementations
make reasonable choices.  I believe a standard-conforming C implementation
can reserve a gigabyte for every integer (to accomodate those really big
integers without dynamic storage allocation :-)).  Yet this doesn't seem
to be a real problem.

RunFinalization may be more of a problem in the short run.  But it seems
to me that likely that implementing it as a noop wil eventually be viewed
about as badly as gigabyte integers, at least for a conventional workstation
implementation.

Hans

Hans-Juergen Boehm
boehm@mti.sgi.com