Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

已知:总内存 =  java heap + no heap(meta space+code cache 等) + 虚拟机进程本身 + 虚拟机栈(线程栈)*线程数 + native heap(一般说的堆外内存)


分析方法:在项目中添加在项目中添加```-XX:NativeMemoryTracking=detailJVM参数重启项目,使用命令detail```JVM参数重启项目,使用命令```jcmd pid VM.native_memory detaildetail```查看到的内存分布如下

Total: reserved=109GB, committed=108GB
-                 Java Heap (reserved=100GB, committed=100GB)
                            (mmap: reserved=100GB, committed=100GB)

-                    Thread (reserved=1GB, committed=1GB)
                            (thread #924)
                            (stack: reserved=1GB, committed=1GB)

-                        GC (reserved=4GB, committed=4GB)
                            (mmap: reserved=4GB, committed=4GB)

-                  Internal (reserved=4GB, committed=4GB)
                            (malloc=4GB #17087)

...