Search code examples
javajvmadoptopenjdkjcmd

Command VM.native_memory not recognized for java process started with -XX:NativeMemoryTracking=summary


My environment is MacOs + Java 11:

java -version 
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.21.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20200715_677 (JIT enabled, AOT enabled)
OpenJ9   - 34cf4c075
OMR      - 113e54219
JCL      - 95bb504fbb based on jdk-11.0.8+10)

I'm starting a Java program with the -XX:NativeMemoryTracking=summary flag.

When I try to access native memory summary I get an error:

jcmd 31395 VM.native_memory summary
Error: Error in command
Command VM.native_memory,summary not recognized

If I list all the available commands for the process I get:

jcmd 31395 help
Dump.heap
Dump.java
Dump.snap
Dump.system
GC.class_histogram
GC.heap_dump
GC.run
Thread.print
help
jstat.class

The command I need is not available. Why isn't it there? How can I enable it?


Solution

  • Native Memory Tracking is a feature of the Oracle HotSpot JVM. You are using the IBM J9 JVM (or more precisely, the open source variant Eclipse OpenJ9 built on Eclipse OMR).