3 ms·
Consider if during collection an object that was only reachable becomes strongly reachable as a result of promotion. This needs to be reconciled at some point,
by kllrnohj 5y ago
Consider if during collection an object that was only reachable becomes strongly reachable as a result of promotion. This needs to be reconciled at some point, and there's also atomicity expectations. If there's 2 weak references for the same object, you can't have one return non-null after the other already returned null (part of the API requirements: https://docs.oracle.com/javase/8/docs/api/java/lang/ref/WeakReference.html https://docs.oracle.com/javase/8/docs/api/java/lang/ref/Weak... )
The easiest way to handle this conflict is to just pause the world when doing the processing of weakrefs after the concurrent GC finishes.