Runtime.getRuntime().freeMemory() with ZGC

Per Liden per.liden at oracle.com
Fri May 28 18:16:15 UTC 2021



On 5/28/21 5:51 PM, Mike Rettig wrote:
> 
> 
> On Fri, May 28, 2021 at 10:13 AM Per Liden <per.liden at oracle.com 
> <mailto:per.liden at oracle.com>> wrote:
> 
>      > Here are the command line memory settings. Soft heap isn't set so
>     I think
>      > that means memory can't be uncommitted.
>      >
>      > -XX:InitialHeapSize=12884901888 -XX:MaxHeapSize=32210157568
>      > -XX:MinHeapSize=12884901888
> 
>     Memory will be uncommitted with this configuration, but only down to
>     MinHeapSize and only memory that has been unused for ZUncommitDelay
>     (which defaults to 300 seconds). So, if you application is filling up
>     the heap regularly and no SoftMaxHeapSize is set, the likelihood of
>     having some memory sit unused for 300s is low and nothing will be
>     uncommitted. On the other hand, if your application were to idle for
>     more than ZUncommitDelay, then unused memory would be uncommitted.
> 
> 
> If SoftMaxHeapSize isn't set then it defaults to MaxHeapSize according 
> to PrintFlagsFinal. It doesn't default to MinHeap. Is the behavior 
> different from what I see by checking the values using -XX:PrintFlagsFinal?

I'm not sure I understand the question, but yes, SoftMaxHeapSize 
defaults to MaxHeapSize.

/Per


> Mike


More information about the zgc-dev mailing list