Thread GC problem
Archie Cobbs
kaffe@rufus.w3.org
Sat, 22 Aug 1998 10:53:49 -0700 (PDT)
breed@almaden.ibm.com writes:
> Are the threads being garbage collected properly? I can't really see where
> the dead threads are getting garbage collected, The finalizer doesn't seem
> to be called on a dead thread, and the # of thread contexts keep
> increasing. My observations are based on running the following program:
>
> import java.util.Random;
> class gctest extends Thread {
> static Random r = new Random();
> byte b[];
> public void run() {
> b = new byte[r.nextInt() & 0xff];
> System.out.println( "all done" );
> }
> protected void finalize() { System.out.println( "Collecting " + this ); }
This may or may not have anything to do with it, but "finalize"
should written as:
protected void finalize() {
System.out.println( "Collecting " + this );
super.finalize();
}
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com