-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
7
-
generic
-
generic
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.
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.
- relates to
-
JDK-4214755 (ref) JDK1.2 handling of nested refs seems to go against API spec
-
- Closed
-
-
JDK-6990442 (ref) Regression to clearing of a softly reachable object
-
- Open
-
-
JDK-8051680 (ref) unnecessary process_soft_ref_reconsider
-
- Resolved
-
-
JDK-8046124 JEP 134: Intuitive Semantics for Nested Reference Objects
-
- Candidate
-