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.

Prerequisites

Start the JVM with summary tracking using the command line option -XX:NativeMemoryTracking=summary. Set the property in the AppNode.tra file. For example, java.extended.properties=-Xmx1024m -Xms128m -XX:NativeMemoryTracking=summary

Procedure

  1. To enable native memory tracking on the JVM, set the parameter -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