JEP draft: Extend native memory tracking to the entirety of the JDK
Author | Johan Sjölén |
Owner | Johan Sjölen |
Type | Feature |
Scope | JDK |
Status | Draft |
Effort | M |
Duration | M |
Created | 2025/04/11 10:35 |
Updated | 2025/07/01 10:44 |
Issue | 8354416 |
Motivation
The Java libraries in the JDK today interacts with native memory more than previously. The JDK libraries interface with native third party libraries, but also handle many low-level concerns. This is because there has been a tendency over the years to have more systems implemented in Java, as opposed to implementing them inside of the JVM. With more native allocations being performed in Java, the ratio of native memory to Java heap objects have increased. Java has great tooling for inspection of objects allocated on the Java heap, however, the JDK libraries' native allocations do not enjoy the same level of tooling. Native Memory Tracking' or NMT for short, is a tool originally developed for the JVM which provides native memory usage statistics. Enabling the usage of NMT for the JDK's libraries would make native memory allocation in the JDK's libraries much less opaque. After this JEP is implemented, JDK developers will be able to enable NMT tracking for all of the JDK's native allocations, not only those done in the Hotspot JVM. Java developers who enable NMT for their services will be able to better understand the native memory usage of the JDK as this tracking is rolled out to the JDK's libraries.