线程堆栈大小与本机内存跟踪线程堆栈大小不匹配

Thread Stack Size Not Matching Native Memory Tracking Thread Stack Size

我目前正在对 Maven Tomcat7 插件的内存设置进行一些测试。我使用以下方法将线程堆栈大小设置为 128k:

set MAVEN_OPTS=-XX:NativeMemoryTracking=summary -Xss128k

在那之后,我 运行 使用本机内存跟踪选项的 jcmd 我得到以下输出。

C:\Users\gdrocell>jcmd 8672 VM.native_memory summary
8672:

Native Memory Tracking:

Total: reserved=9995213KB, committed=1283517KB
-                 Java Heap (reserved=8282112KB, committed=868864KB)
                            (mmap: reserved=8282112KB, committed=868864KB)

-                     Class (reserved=1103777KB, committed=59857KB)
                            (classes #9079)
                            (malloc=10145KB #11226)
                            (mmap: reserved=1093632KB, committed=49712KB)

-                    Thread (reserved=15844KB, committed=15844KB)
                            (thread #25)
                            (stack: reserved=15616KB, committed=15616KB)
                            (malloc=72KB #132)
                            (arena=156KB #48)

-                      Code (reserved=253665KB, committed=23761KB)
                            (malloc=4065KB #6562)
                            (mmap: reserved=249600KB, committed=19696KB)

-                        GC (reserved=313042KB, committed=288418KB)
                            (malloc=10386KB #203)
                            (mmap: reserved=302656KB, committed=278032KB)

-                  Compiler (reserved=152KB, committed=152KB)
                            (malloc=21KB #204)
                            (arena=131KB #3)

-                  Internal (reserved=10653KB, committed=10653KB)
                            (malloc=10589KB #10938)
                            (mmap: reserved=64KB, committed=64KB)

-                    Symbol (reserved=13705KB, committed=13705KB)
                            (malloc=10756KB #102196)
                            (arena=2949KB #1)

-    Native Memory Tracking (reserved=2065KB, committed=2065KB)
                            (malloc=7KB #85)
                            (tracking overhead=2058KB)

-               Arena Chunk (reserved=197KB, committed=197KB)
                            (malloc=197KB)

如您所见,线程堆栈大小似乎为 15.25mb。有谁知道这是为什么?

根据此博客 (https://blogs.oracle.com/saas-fusion-app-performance/how-to-set-stack-size-to-overcome-javalangWhosebugerror)

If it is not possible to change the stack requirements of the application, you can change the thread stack size by using the -Xss command-line option.

这是每个线程的堆栈大小。你说的数字会随着线程数的不同而不同。

编辑

大约有 120 个线程。我会使用 -XX:NativeMemoryTracking=detail。查看信息是否更有意义