Runtime.getRuntime().freeMemory() with ZGC
Mike Rettig
mike.rettig at gmail.com
Fri May 28 20:21:10 UTC 2021
On Fri, May 28, 2021 at 1:50 PM Per Liden <per.liden at oracle.com> wrote:
> > How is it possible for memory to be uncommitted down to MinHeapSize
> > based on the configuration I provided? Does ZGC uncommit memory below
> > SoftMaxHeapSize?
>
> Yes, the lower limit for uncommit is MinHeapSize, so it can uncommit
> below SoftMaxHeapSize. SoftMaxHeapSize is in this context just used as a
> way to make memory that it's strictly needed by the application become
> "aged" and thereby become eligible for uncommit with regards to
> ZUncommitDelay.
>
> /Per
>
For my purposes, I can set min heap equal to max heap then it will work as
I intended. I don't want memory uncommitted once it has been claimed by the
jvm.
However, I don't feel that I fully understand the relationships between the
settings. In your article, what is the value of the MinHeapSize? Does
MinHeapSize affect the behavior as described in the article? Will the
behavior change if the min heap is equal to the max heap?
https://malloc.se/blog/zgc-softmaxheapsize
As I've said in prior posts, I think ZGC (and other gc's) could be easier
to use if the jvm options captured the goals of the users. Because ZGC
lacks a good tuning option, I've spent a lot time experimenting with
options trying to get the behavior I want. I never had to do this with G1.
I just set MaxGCPauseMillis and things worked as I expected. The final ZGC
settings that I'm using are not ideal. I've decided to just give ZGC more
memory than I think it will ever need since I don't have an easy way to
specify the balance of memory vs pause time that I would consider healthy.
Thanks,
Mike
More information about the zgc-dev
mailing list