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

non-resurrectible finalization mechanism required

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mr Mark Reinhold
                Reporter:
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: