visualvm icon indicating copy to clipboard operation
visualvm copied to clipboard

Wrong/Inconsistent Max Metaspace value

Open silver-mx opened this issue 3 years ago • 1 comments

Visual VM 2.0.7 shows an incorrect Max Metaspace value. If you observe the screenshots below you can see that the application (available at https://github.com/silver-mx/jvm-memory-metrics-demo) was started with -XX:MaxMetaspaceSize=64m, but Visual VM reports 84MB ( 88 080 384B) (see screenshot). I double-checked what value is given in JConsole and that it is 65 536 kbytes which is accurate (see screenshot).

To Reproduce Steps to reproduce the behavior:

  1. Clone the repository available at https://github.com/silver-mx/jvm-memory-metrics-demo.
  2. Run mvnw spring-boot:run
  3. Open VisualVM 2.0.7 and click on the application com.dns.metrics.JvmMemoryMetricsApplicationDemo
  4. Observe the Metaspace Max value.

Expected behavior I expect the Metaspace max value to reflect the 64MB assigned via XX:MaxMetaspaceSize=64m.

Screenshots visualvm-show-max-metaspace visualvm-show-max-metaspace-2 visualvm-show-max-metaspace-3

Desktop (please complete the following information):

  • OS: [Windows 10 and Linux Manjaro]
  • JDK version [jdk-16.0.1.9-hotspot]
  • Version [16]

silver-mx avatar Jun 27 '21 09:06 silver-mx

This bug can be reproduce only if the memory is monitored via jvmstat (typically for local process). Monitoring via JMX (typically remote process) works fine.

thurka avatar Jun 28 '21 07:06 thurka