Top 3 `jcmd` Commands for NMT Diagnostics
Effectively diagnosing native memory leaks with NMT often relies on three key `jcmd` commands: `VM.native_memory summary` for overall category-based usage, `VM.native_memory baseline` to establish a snapshot, and `VM.native_memory summary.diff` or `detail.diff` to pinpoint memory growth since the baseline.
The top 3
- Top Command for Quick NMT Overview: The `jcmd <pid> VM.native_memory summary` command delivers a high-level breakdown of JVM native memory usage, categorized by subsystems like Java Heap, Class, Thread, Code, and GC, ideal for initial assessments.
- Deep Dive with NMT Detail Reporting: For granular insights into native memory, `jcmd <pid> VM.native_memory detail` reveals memory usage aggregated by category, virtual memory maps, and even by individual call sites, requiring NMT to be enabled with `-XX:NativeMemoryTracking=detail` at JVM startup.
- Detecting Leaks: Baseline and Diff Analysis: To pinpoint native memory leaks, use `jcmd <pid> VM.native_memory baseline` to establish a snapshot, followed by `jcmd <pid> VM.native_memory summary.diff` or `detail.diff` to report changes since the baseline, highlighting growing memory categories.
Open the full topic