We have a Java application running in openjdk8 whose max heap memory changes at runtime - what might be the reason of that?
I have found question Why the heap is changing in java which points to the article which explains difference between max
and committed
memory. It seems that in our case these two are usually the same, but not always - see at 11:53 on screenshots below.
Heap can be also changed be young generation serial collector (-XX:MaxHeapFreeRatio
, see Encourage the JVM to GC rather than grow the heap?), however we use parallel collector so this is not the case.
The memory related JVM parameters that we run the application with:
-XX:MaxMetaspaceSize=200M -Xms2000m -Xmx2000m
Not sure if it's related, the application was doing parallel mark sweep on old generations between 11:55 and 11:58 - at this time there was over 200MB free memory available and we cannot see any reason for that behaviour.
The heap is increasing continuously, because there are allocations, up until the garbage collector runs and reclaims the memory. That's the normal pattern of garbage collected heaps.
The heap memories for either server are created at the JVM start-up with a default value of 4096 MB. If the default value is insufficient to suit the memory consumption of either server, you can change the maximum heap size to a value that ranges between 4096 and 8192 Mbytes.
The Java™ virtual machine (JVM) heap size setting directly relates to how many server instances can be started within a dynamic cluster on a specific node. You might need to modify the JVM heap size setting based on your environment configuration. The default value is 256 MB.
You are using Parallel GC which has adaptive size policy on by default.
Set -XX:-UseAdaptiveSizePolicy
if you don't want heap generations to resize.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With