It seems that calculation of MemoryMXBean.getNonHeapMemoryUsage(jmm_GetMemoryUsage) is wrong.
Currently, NonHeapUsage = CodeCache + Metaspace + CompressedClassSpace ==> CodeHeap 'non-nmethods' 1532544 (Used) ==> CodeHeap 'profiled nmethods' 0 ==> CodeHeap 'non-profiled nmethods' 13952 ==> Metaspace 506696 ==> Compressed Class Space 43312 init = 7667712(7488K) used = 2096504(2047K) committed = 8454144(8256K) max = -1(-1K) In this way, getNonHeapMemoryUsage is larger than it ought to be, it should be NonHeapUsage = CodeCache + Metaspace. ------------- Commit messages: - 8287135 Calculation of jmm_GetMemoryUsage is wrong Changes: https://git.openjdk.java.net/jdk/pull/8831/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8831&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287135 Stats: 10 lines in 2 files changed: 9 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8831.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8831/head:pull/8831 PR: https://git.openjdk.java.net/jdk/pull/8831