Re: class gc (fwd)

Date view Thread view Subject view Author view

From: Godmar Back (gback@marker.cs.utah.edu)
Date: Thu Dec 17 1998 - 15:59:59 EST


    How about the following mechanism: when a class is loaded, we check
    whether there's a classFinalize or not. If there is, we instantiate a
    helper class that will invoke the classFinalizer and replace its
    reference in the classFinalize with another helper object, that will
    then invoke the actual finalizer.

    I think the same applies to other finalizable objects, such as
    Threads, otherwise we may end up disallocating the stack of a Thread
    before its finalizer starts the Thread (if this is possible at all).
    So we won't break given the following (untested) code:

    class Test extends Thread {
      public void finalize() { start(); }
      public void run() { System.out.println("Worked!"); }
      private void test() { new Test(); }
      public static void main(String[] argv) {
        new Test();
        System.gc();
        System.runFinalization();
      }
    }

Okay, I don't understand your proposal.
How do you want to prevent difficulties from reattachment
attempts in the finalizer? Or other attempts to use data structure
deallocated in the quasi-finalizer?

        - Godmar


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:20 EDT