Runtime.getRuntime().freeMemory() with ZGC

Per Liden per.liden at
Tue Jun 8 07:07:28 UTC 2021

On 6/4/21 5:25 PM, Mike Rettig wrote:
> On Thu, Jun 3, 2021 at 11:25 AM Per Liden <per.liden at 
> <mailto:per.liden at>> wrote:
>     If "Proactive" GCs kick more frequently than the ZCollectionInterval
>     you
>     want to use, then disabling it (-XX:-ZProactive) is a good idea.
> As you said before, ZProactive collections run when impact should be 
> minimal. Is there any other criteria for it to run? I disabled it 

It only runs if it thinks it will have minimal impact.

> because it was too aggressive. It was running frequently even if the 
> heap usage was really low. Is there a heap usage (current heap not -Xmx) 
> threshold?  I think that could be even better than a max pause 
> threshold.  If I could configure proactive collections to run only if 
> the current heap usage > 75% then GC performance would be ideal. ZGC 
> would be able to grow/shrink the heap as needed while also minimizing 
> the impact on the app.

Check. Yes, proactive GCs can currently only be turned on or off, i.e. 
there is currently no other configuration option to influence it.


More information about the zgc-dev mailing list