I have this code:
public class F
{
protected void finalize() throws Throwable
{
System.out.println("finalize");
super.finalize();
}
public static void main(String[] args) throws Throwable
{
F f = new F();
System.runFinalizersOnExit(true);
Runtime.getRuntime().runFinalizersOnExit(true);
f = null;
System.gc();
}
}
My documentation leads me to expect that finalize() will be run and produce
this output:
finalize
However, it produces no output.
[summer@possum summer]$ java -fullversion
java full version "Linux_JDK_1.1.7_v1a_green_threads"
I'm running RedHat Linux 5.0, kernel 2.0.36:
[summer@possum summer]$ uname -a
Linux possum.os2.ami.com.au 2.0.36 #4 Wed Dec 30 20:13:06 WST 1998 i686 unknown
--
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.