物理内存占用

Committed & Reserved & RSS

Committed

Address ranges that have been mapped with something other than PROT_NONE. They may or may not be backed by physical or swap due to lazy allocation and paging.

Reserved

The total address range that has been pre-mapped via mmap for a particular memory pool.
Committed的区别在于Reserved包含PROT_NONE一定不占用物理内存）的映射

RSS

Resident set size, the non-swapped physical memory that a task has used (in kiloBytes)

内存占用分解

Heap/Metaspace

Heap = SC + EC + OC = 16384 + 262144 + 245760 = 524288
Metaspace = 155596

栈空间

• 线程数量

• 实际占用

ThreadStackSize 线程数量 = 1024 423 = 433152
注意：这个实际上是Reserved内存，NMT报告为了CommittedJDK-8191369

• 其他

• 直接申请的堆外内存，如DirectBuffer
• Codecache

Native Memory Tracking

JDK1.8自带的内存统计工具，通过-XX:NativeMemoryTracking=summary启用，启用会带来5~10%的性能开销