Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisualVM shows double Xmx as Max Heap Size

Tags:

java

g1gc

I have the following problem:

There is a Java VM with Xmx Option set to 70000m = 70GB (Yes, it is that big). But if I monitor the before mentioned JVM, Max Heap is shown as 140000m (as seen in the screenshot).

Screenshot

Following a listing of used JVM options:

-XX:+UseG1GC
-Duser.timezone=Europe/Berlin
-Djava.security.egd=file:///dev/urandom
-Dsun.rmi.transport.tcp.handshakeTimeout=180000
-Dsun.rmi.dgc.client.gcInterval=600000
-Dsun.rmi.dgc.server.gcInterval=600000
-verbose:gc
-XX:CICompilerCount=2
-Xrunjdwp:transport=dt_socket,server=y,address=3997,suspend=n
-Xms70000m
-Xmx70000m
-XX:+UnlockExperimentalVMOptions
-XX:G1HeapRegionSize=32
-XX:MaxGCPauseMillis=200
-XX:G1NewSizePercent=2
-XX:G1MaxNewSizePercent=60
-XX:ParallelGCThreads=8
-XX:ConcGCThreads=2
-XX:InitiatingHeapOccupancyPercent=45
-XX:G1MixedGCLiveThresholdPercent=65
-XX:G1HeapWastePercent=10
-XX:G1OldCSetRegionThresholdPercent=10
-XX:G1ReservePercent=10

Has anybody a hint, why VisualVM shows double max heap size?

like image 446
dRoeder Avatar asked Nov 09 '15 13:11

dRoeder


People also ask

How do I set maximum heap size?

Under the Java tab, select JVM Options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.

How does VisualVM analyze heap dump?

Opening a Heap Dump File If you have a heap dump file saved on your local system, you can open the file in Java VisualVM by choosing File > Load from the main menu. Java VisualVM can open heap dumps saved in the . hprof file format. When you open a saved heap dump, the heap dump opens as a tab in the main window.


1 Answers

This is a bug in visualVM when using the G1 garbage collector, the max is not actually this large. Jconsole does report it correctly.

The following report provides a possible explanation. The reason here is that the different generations no longer have a fixed size, but instead the max size for each is the size of the full heap (as they can both use as much as needed). I have not been able to find any official bug report for this yet.

like image 143
Thirler Avatar answered Oct 16 '22 13:10

Thirler