RFR: System.gc() with ExplicitGCInvokesConcurrent should block

Aleksey Shipilev shade at redhat.com
Wed Sep 6 15:58:58 UTC 2017


On 09/06/2017 05:56 PM, Zhengyu Gu wrote:
> 
> 
> On 09/06/2017 11:20 AM, Aleksey Shipilev wrote:
>> Hi,
>>
>> Current ExplicitGCInvokesConcurrent violates the System.gc() contract in this part: "***When control
>> returns from the method call,*** the Java Virtual Machine has made a best effort to reclaim space
>> from all discarded objects.". To fix it, we need to wait for the end of cycle before returning from
>> System.gc() call:
>>    http://cr.openjdk.java.net/~shade/shenandoah/concthread-eic-block/webrev.01/
> 
> Does it make sense to move flag setting inside mutex lock? it provides release-unlock semantics.

Nope, because the is_conc_gc_requested() is lock-free.

-Aleksey



More information about the shenandoah-dev mailing list