[1380] in java-interest

home help back first fref pref prev next nref lref last post

Resource cleanup checking

daemon@ATHENA.MIT.EDU (Robert O'Callahan)
Thu Aug 31 13:20:19 1995

Date: Thu, 31 Aug 1995 09:55:10 -0400
To: java-interest@java.sun.com
From: "Robert O'Callahan" <roc+@cs.cmu.edu>

No-one seems to have mentioned "finalize" yet.  This method gets called when
an object is garbage-collected, which gives you a last chance to clean up
file descriptors or GDI handles or whatever.  The documentation notes that
you can't depend on when garbage collection happens (or even if it happens
at all), so this may not seem that useful.  But, if you intend an object to
always be explicitly "dispose"'d, why not have "finalize" print a warning
message if the object has not been disposed already?  I'm not sure if
"finalize" gets called on all extant objects when Java exits, but that
surely wouldn be easy to hack into a debugging version of the runtime.  This
would seem to give you all the power of Purify and friends, in fact a lot
more, because it's readily extensible.

By the way, anyone know anything about the state of native code generation?

Rob
[Robert O'Callahan (roc+@cs.cmu.edu) 1st year CMU SCS PhD
Home page: http://www.cs.cmu.edu/~roc
"Grant that we may not so much seek to be consoled as to console; to
be understood as to understand; to be loved as to love." 
- From A Prayer of St Francis]

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post