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

(ref) Soft reference could consider strong if GC decides not to clear

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • None
    • 7
    • core-libs
    • generic
    • generic

    Description

      The scenario is depicted in this object graph:
         Root -> .... -> SR -> A -> ... -> WR -> B -> ....

      where SR is a SoftReference that points to object A and WR is a WeakReference
      that points to object B. Both A and B are not reachable.

      As specified in the java.lang.ref spec, B is softly reachable as
      (1) B is not strongly reachable, and
      (2) B can be reached by traversing a soft reference (SR)

      B is not weakly-reachable since it is softly reachable as described
      above.

      When GC decides not to clear the soft reference, it would be intuitive
      to consider that as a strong reference for the rest of the GC operation
      and therefore clear WR and reclaim B. The behavior conforming to
      the current specification doesn't clear WR (as B is not weakly reachable).

      This RFE is to request an enhancement to the java.lang.ref API to
      support this new behavior.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mchung Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: