0

I'm at a loss regarding the reported memory usage of my Java application (deployed on JBoss EAP) when under load. The java.exe process memory as shown by Windows Resource Monitor is much higher than what is reported by jcmd VM.native_memory.

How can I investigate the difference?

Example

  • jcmd: Total: reserved=8417542KB, committed=7308422KB
  • Windows Resource Monitor: Commit ("zugesichert") 12270304 KB java.exe as reported by Windows Resource Monitor

Environment

  • Oracle JDK 11.0.18
    • Heap size (Xmx) 6 GB [fully committed according to jcmd]
    • G1 GC
  • JBoss EAP 7.4.8
  • Windows Server 2016
  • The machine is a Hyper-V hosted VM with 8 GB RAM

Further observations

Memory usage as per Resource Monitor keeps growing continually while under load whereas the values reported by jcmd seem to stabilize around 8.5 GB reserved and 7ish GB committed.

nodots
  • 1,450
  • 11
  • 19
  • For G1 memory use (as reported by the OS), this may also be relevant: https://openjdk.org/jeps/346 – Jorn Vernee Feb 27 '23 at 15:55
  • 1
    For better understanding JVM's memory usage I recommend the following excellent post: https://stackoverflow.com/questions/53451103/java-using-much-more-memory-than-heap-size-or-size-correctly-docker-memory-limi/53624438#53624438 – Juraj Martinka Feb 27 '23 at 17:48
  • @JornVernee After re-reading JEP 346 I'm still unclear how it applies (or if at all). Yes, 6 GB heap are fully committed, confirmed by jcmd. So apparently no heap mem has been returned to the OS. But there are ~4 GB unaccounted for. How could JEP 346 play a role in this? – nodots Feb 28 '23 at 08:32
  • Thanks @JurajMartinka , excellent overview indeed, I'll research further starting from there – nodots Feb 28 '23 at 08:39
  • If you look at the JEP, it states that it was delivered in Java 12, you are using Java 11. Still, the JEP describes the behavior before, which does apply to you. – Johannes Kuhn Feb 28 '23 at 14:15
  • @JohannesKuhn I agree that JEP 346 describes potentially relevant G1 GC behavior in Java 11. However, I fail to understand how it helps explaining the observed difference in reported memory usage. I think (and perhaps this is incorrect?) that as long as the GC does not return committed memory to the OS, the JVM still has it and jcmd should report it. – nodots Mar 01 '23 at 07:30

0 Answers0