Native Memory Tracking
The Native Memory Tracking (NMT) is a Java HotSpot VM feature that tracks internal memory usage for a Java HotSpot VM.
Note: This utility works on Windows OS and Linux OS.
For more information about Native Memory Tracking, see docs.oracle.com.
- Procedure
- 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 - Establish an early baseline. Use NMT baseline feature to get a baseline to compare by running command: jcmd <pid> VM.native_memory baseline.
- Collect the memory data after starting the test runs by running jcmd <pid> VM.native_memory summary.
- To monitor memory changes, use the following command: jcmd <pid> VM.native_memory summary.diff
- 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.
- The jcmd utility is shipped with JDK. It is under
$JDK_HOME/bin directory.
For more information about jcmd utility, see docs.oracle.com