Native Memory Tracking

The Native Memory Tracking (NMT) is a Java HotSpot VM feature that tracks internal memory usage for a Java HotSpot VM.

For more information about Native Memory Tracking, see docs.oracle.com.

Procedure

  1. To enable native memory tracking on the JVM, set the parameter -XX:NativeMemoryTracking=summary in the BW_JAVA_OPTS environment variable. For example: BW_JAVA_OPTS="-Xmx1024M -Xms1024M -XX:NativeMemoryTracking=summary
  2. Establish an early baseline. Use NMT baseline feature to get a baseline to compare by running command: jcmd <pid> VM.native_memory baseline.
  3. Collect the memory data after starting the test runs by running jcmd <pid> VM.native_memory summary.
  4. To monitor memory changes, use the following command: jcmd <pid> VM.native_memory summary.diff
  5. If the application leaks a small amount of memory, it takes a while to show up. Comparing the memory pools from NMT output help identify the memory pool contributing to increase in memory.
  6. The jcmd utility is shipped with JDK. It is under $JDK_HOME/bin directory.
    For more information about jcmd utility, see docs.oracle.com