I know that in Java we have the concept of soft link. What to do, if:
1) There is a soft link "sf" refers to object A
2) In object A, it has a strong reference to object B
3) objects A and B are not mentioned anywhere else.
By definition, object A and object B are “mildly reachable,” right?
Then let's say that we are running out of memory, GC starts up. Is it possible that the GC will recycle object B, but not object A?
If in this case, if we want to access object B through "sf", it will be zero. How java avoids such a case?
I do not see any explanation in java doc.
source
share