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

Aleksey Shipilev shade at redhat.com
Tue May 28 18:06:30 UTC 2019

On 5/28/19 7:58 PM, Roger Riggs wrote:
> Please review a change to the javadoc of Runtime.gc() and System.gc() to clarify
> that invoking these methods does not guarantee any specific result or timeliness
> of completion.
> The revised text is:
>       * Runs the garbage collector in the Java Virtual Machine.
>       *
>       * 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.
>       * 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/index.html

Thank you.

It feels like <p/> is missing between paragraphs?

Also, I don't think it is sensible to drop the blocking behavior ("When control returns...") -- I
think some programs enjoy that property, and certainly many GCs have special tests to enforce this
property, even if GC is fully concurrent.


More information about the core-libs-dev mailing list