8289838: ZGC: OOM before clearing all SoftReferences

Reviewed-by: ayang, tschatzl
This commit is contained in:
Erik Österlund 2022-11-02 16:36:38 +00:00
parent a1c349f8b3
commit 491d43c187

View File

@ -225,6 +225,14 @@ void ZHeap::mark_start() {
// Verification
ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_strong);
if (ZHeap::heap()->has_alloc_stalled()) {
// If there are stalled allocations, ensure that regardless of the
// cause of the GC, we have to clear soft references, as we are just
// about to increment the sequence number, and all previous allocations
// will throw if not presented with enough memory.
ZHeap::heap()->set_soft_reference_policy(true);
}
// Flip address view
flip_to_marked();