Thread GC problem

Archie Cobbs archie at whistle.com
Sat Aug 22 10:53:49 PDT 1998


breed at 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


More information about the kaffe mailing list