RFR(S) 8245925 G1 allocates EDEN region after CDS has executed GC

Ioi Lam ioi.lam at oracle.com
Sat May 30 02:29:45 UTC 2020



CDS supports archived heap objects only for G1. During -Xshare:dump,
CDS executes a full GC so that G1 will compact the heap regions, leaving
maximum contiguous free space at the top of the heap. Then, the archived
heap regions are allocated from the top of the heap.

Under some circumstances, java.lang.ref.Cleaners will execute
after the GC has completed. The cleaners may allocate or synchronized, which
will cause G1 to allocate an EDEN region at the top of the heap.

The fix is simple -- after CDS has entered a safepoint, if EDEN regions 
exit the safepoint, run GC, and try again. Eventually all the cleaners will
be executed and no more allocation can happen.

For safety, I limit the retry count to 30 (or about total 9 seconds).

- Ioi


More information about the hotspot-gc-dev mailing list