JVisualVM indicates -Xmx is being ignored when passed inline

87 Views Asked by At

Read through a number of similar issues and some were completely different or didn't provide an explanation.

Here is how the application is executed. A size of 1234M is used to ensure no default value is being picked up. Also verified no Java related Environment Variables are set.

> java -Xms512M -Xmx1234M -jar myApp.jar

When the application loads, JVisualVM shows the following and based on the JVM Arguments the -Xmx is visble.

-Xmx1234M is visible here

Under the Monitor tab, the graphical view is inspected and this shows a max heap size of 8G.

8Gigs of heap

If multiple applications are running, this could be problematic. As a test, the _JAVA_OPTIONS=-Xms1024m -Xmx2222m environment variable is set. The value 2222 is used to help verify no default value gets picked up.

Once again JVisualVM shows the proper size passed in :

2nd Test

Under the Monitor tab, the graphical view is inspected and this shows the value from the environment variable.

Correct value here.

Why does java not pickup the values passed in via the command line?

0

There are 0 best solutions below