本篇文章为你整理了Native Memory Tracking()的详细内容,包含有 Native Memory Tracking,希望能帮助你了解 Native Memory Tracking。
JavaScript is not supported by your browser. JavaScript
support is required for full functionality of this page.
Contents Previous Next2.7 Native Memory TrackingThe Native Memory Tracking (NMT) is a Java HotSpot VM feature that tracks internal memory usage for a Java HotSpot VM. For details about NMT scope, how to enable NMT, and other additional usage details, see Native Memory Tracking.
Since NMT doesnt track memory allocations by non-JVM code, you may have to use tools supported by the operating system to detect memory leaks in native code.
The following sections describe how to monitor VM internal memory allocations and diagnose VM memory leaks.
2.7.1 Use NMT to Detect a Memory LeakFollow these steps to detect a memory leak.
Start the JVM with summary or detail tracking using the command line option: -XX:NativeMemoryTracking=summary or -XX:NativeMemoryTracking=detail.
Establish an early baseline - use NMT baseline feature to get a baseline to compare during development and maintenance by running: jcmd pid VM.native_memory baseline.
Monitor memory changes using: jcmd pid VM.native_memory detail.diff.
If the application leaks a small amount of memory, it make take a while to show up.
2.7.2 How to Monitor VM Internal MemoryUsed with The jcmd Utility, Native Memory Tracking can be set up to monitor memory and ensure that an application does not start to use increasing amounts of memory during development or maintenance. See Table 2-1 for details about NMT memory categories.
The following sections describe how to get summary or detail data for NMT and describes how to interpret the sample output.
Interpret sample output: From the sample output below, you will see reserved and committed memory. Note that only committed memory is actually used. For example, if you run with -Xms100m -Xmx1000m, the JVM will reserve 1000 MB for the Java Heap. Since the initial heap size is only 100 MB, only 100MB will be committed to begin with. For a 64-bit machine where address space is almost unlimited, there is no problem if a JVM reserves a lot of memory. The problem arises if more and more memory gets committed, which may lead to swapping or native OOM situations.
Arena is a chunk of memory allocated using malloc. Memory is freed from these chunks in bulk, when exiting a scope or leaving an area of code. These chunks may be reused in other subsystems to hold temporary memory, for example, pre-thread allocations. Arena malloc policy ensures no memory leakage. So Arena is tracked as a whole and not individual objects. Some amount of initial memory can not by tracked.
Enabling NMT will result in a 5-10 percent JVM performance drop and memory usage for NMT adds 2 machine words to all malloc memory as malloc header. NMT memory usage is also tracked by NMT.
以上就是Native Memory Tracking()的详细内容,想要了解更多 Native Memory Tracking的内容,请持续关注盛行IT软件开发工作室。
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。