On Tue, 5 Jan 1999, Daniel W. Dulitz x108 wrote:
> John Summerfield writes:
> > Someone mentioned offline (please, all, keep discussion ON the list) that
> > it's possible to force garbage collection. My code has the necessary
> > statements to do that (two versions that I found).
>
> If (as someone else indicated) Sun's JVM uses a conservative garbage
> collector, then even though one may force garbage collection, there's
> no way to force the garbage collector to recognize that a particular
> object is in fact garbage.
>
> Another writer seemed worried about memory consumption, and while it's
> true that conservative GCs are not as efficient at reclaiming space as
> traditional closed-world GCs, they're fine for most applications.
>
> The semantics of the runFinalizersOnExit() method, as described in the
> Javadoc for java.lang.System, are sweet; but I've never gotten that
> method to work either. Those semantics would be very difficult (or
> impossible) to achieve with a conservative garbage collector.
>
> There is a workaround, if you don't need to garbage collect the
> objects that must be finalized: in the constructor, add the new object
> to a Vector; when you're done with one run the finalizer yourself.
I CAN call the finalizer() mtself. However, I'm trying to write a class
that will clean itself up without the programmer having to remember to call
it. This is a use for finalizer() that's described in JustJava by Peter van
der Linden, who works (or worked) for Sun.
--
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.