RFR 8220238 : Enhancing j.l.Runtime/System::gc specification with an explicit 'no guarantee' statement

David Holmes david.holmes at oracle.com
Wed May 29 22:10:50 UTC 2019

Hi Roger,

I think it is important that the "best effort" be kept as per this 
version. It may not be a directly testable property but it does capture 
intent regarding quality-of-implementation IMO.


On 30/05/2019 5:25 am, Roger Riggs wrote:
> Hi,
> ok, thanks for the comments.
> Any other comments on:
> "* Runs the garbage collector in the Java Virtual Machine.
> * <p>
> * Calling this method suggests that the Java Virtual Machine
> * expend effort toward recycling unused objects in order to
> * make the memory they currently occupy available for reuse
> * by the Java Virtual Machine.
> * When control returns from the method call, the Java Virtual Machine
> * has made a best effort to reclaim space from all discarded objects.
> * There is no guarantee that this effort will recycle any particular
> * number of unused objects, reclaim any particular amount of space,
> * or complete at any particular time, if at all.
> "
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8220238
> CSR:
> https://bugs.openjdk.java.net/browse/JDK-8224760
> Webrev:
>    http://cr.openjdk.java.net/~rriggs/webrev-gc-8220238-1/
> Thanks, Roger
> On 05/29/2019 01:38 PM, Aleksey Shipilev wrote:
>> On 5/29/19 5:06 PM, Roger Riggs wrote:
>>> The language is hard to construct, in part because of the innovations 
>>> in gc technology that have
>>> resulted such a wide range of behaviors and timing.
>>> I'll restore the sentence "When control returns"... but I don't think 
>>> it carries any
>>> definite requirement on an implementation. It is benign since 'best 
>>> effort' is undefined
>>> and depends on the unspecified intentions of the implementation(s).
>> "When control returns" does mean things for me (GC implementor). We 
>> specifically handle blocking
>> callers on System.gc() calls in Shenandoah (and partially in Epsilon). 
>> I would not be surprised if
>> JCK has tests for that as well.
>> I think "best effort" is orthogonal to blocking behavior.
>> -Aleksey

More information about the core-libs-dev mailing list