Documentation Contents

Native Memory Tracking

Overview

The Native Memory Tracking (NMT) is a Java Hotspot VM feature that tracks internal memory usage for a HotSpot JVM. You can access NMT data using jcmd utility. NMT in this release does not track third party native code memory allocations and JDK class libraries. Also, this release does not include NMT MBean in HotSpot for JMC.

Key Features

Native Memory Tracking has the following features and when used with jcmd can track memory usage at differnet levels.

How to Use Native Memory Tracking

First enable NMT and then use jcmd to access the data collected thus far.

Enable NMT

Enable NMT using the following command line. Note that enabling this will cause 5-10% performance overhead.

-XX:NativeMemoryTracking=[off | summary | detail]

off NMT is turned off by default.
summary Only collect memory usage aggregated by subsystem.
detail Collect memory usage by individual call sites.

Use jcmd to Access NMT Data

Use jcmd to dump the data collected and optionally compare it to the last baseline.

jcmd <pid> VM.native_memory [summary | detail | baseline | summary.diff | detail.diff | shutdown] [scale= KB | MB | GB]

summary Print a summary aggregated by category.
detail
  • Print memory usage aggregated by category
  • Print virtual memory map
  • Print memory usage aggregated by call site
baseline Create a new memory usage snapshot to diff against.
summary.diff Print a new summary report against the last baseline.
detail.diff Print a new detail report against the last baseline.
shutdown Shutdown NMT.

NMT at VM Exit

Use the following VM diagnostic command line option to obtain last memory usage data at VM exit when Native Memory Tracking is enabled. The level of detail is based on tracking level.

-XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics

See Troubleshooting Guide on how to monitor VM internal memory allocations and diagnose VM memory leaks.


Oracle and/or its affiliates Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
Contact Us