Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4701292

non-resurrectible finalization mechanism required

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • None
    • generic
    • generic

      the current finalization mechanism can obviously resurrect
      the object & hence objects with a finalize() method can
      cause serious gc performance problems (see bugs like
      4525290 and 4239841 - which probably aren't bugs but do
      demonstrate the issue)

      one solution is to develop the application such that classes
      do not have finalize() methods but to instead use weak or
      phantom references so that the original object (referent) can
      undergo gc immediately & the tidyup can be done sometime later.

      whilst this workaround is not difficult for an application
      developer to implement, it is still a lot more work that using
      a finalize() method. also, it requires the application developer
      to create the required infrastructure so is not something that
      an isv providing utility class libraries could use.

      one solution (requiring no lang change) would be to add a
      system reference queue (sort of thing;) to which one could add an
      object (which is used like a weak/phantom referent) and an associated
      FinalizationObject (sort of thing) whose doTidyup() method could
      be called by the (system provided) thread monitoring this ref queue.

      maybe some sort of (java language supported?) inner
      finalization class would be more elegant.

            mr Mark Reinhold
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: