竞技场对JVM NMT的输出意味着什么

发布于 2025-02-13 04:02:42 字数 2422 浏览 1 评论 0原文

我为Java应用程序运行了'JCMD vm.native_memory详细信息',输出就像:

Total: reserved=4741MB, committed=3506MB
-                 Java Heap (reserved=2350MB, committed=2350MB)
                            (mmap: reserved=2350MB, committed=2350MB)

-                     Class (reserved=1676MB, committed=751MB)
                            (classes #151986)
                            (  instance classes #144245, array classes #7741)
                            (malloc=24MB #383379)
                            (mmap: reserved=1652MB, committed=727MB)
                            (  Metadata:   )
                            (    reserved=628MB, committed=626MB)
                            (    used=613MB)
                            (    free=13MB)
                            (    waste=0MB =0.00%)
                            (  Class space:)
                            (    reserved=1024MB, committed=100MB)
                            (    used=92MB)
                            (    free=8MB)
                            (    waste=0MB =0.00%)

-                    Thread (reserved=214MB, committed=26MB)
                            (thread #219)
                            (stack: reserved=213MB, committed=25MB)
                            (malloc=1MB #1316)
...
OMIT SOME LINES HERE 
...

-                  Internal (reserved=10MB, committed=10MB)
                            (malloc=10MB #9058)
-                    Symbol (reserved=44MB, committed=44MB)
                            (malloc=41MB #560526)               --> isn't malloc function backed up by arena under glibc?
                            (arena=2MB #1)                      --> what does this line mean?

-    Native Memory Tracking (reserved=19MB, committed=19MB)
                            (malloc=1MB #7348)
                            (tracking overhead=18MB)

-        Shared class space (reserved=17MB, committed=17MB)
                            (mmap: reserved=17MB, committed=17MB)

-               Arena Chunk (reserved=6MB, committed=6MB).           --> What does this block suggest?
                            (malloc=6MB)

-                    Module (reserved=3MB, committed=3MB)
                            (malloc=3MB #18535)

take 符号块,例如,malloc和竞技场有什么区别? Java应用程序使用GLIBC在Linux上运行,因此我认为(也许我错了)实际上负责内存管理负责。但是,为什么在竞技场分配的记忆下方有另一个分开的线?

竞技场块块意味着什么? 你能启发我吗?谢谢。

I ran 'jcmd VM.native_memory detail' for a Java application, and the output was like:

Total: reserved=4741MB, committed=3506MB
-                 Java Heap (reserved=2350MB, committed=2350MB)
                            (mmap: reserved=2350MB, committed=2350MB)

-                     Class (reserved=1676MB, committed=751MB)
                            (classes #151986)
                            (  instance classes #144245, array classes #7741)
                            (malloc=24MB #383379)
                            (mmap: reserved=1652MB, committed=727MB)
                            (  Metadata:   )
                            (    reserved=628MB, committed=626MB)
                            (    used=613MB)
                            (    free=13MB)
                            (    waste=0MB =0.00%)
                            (  Class space:)
                            (    reserved=1024MB, committed=100MB)
                            (    used=92MB)
                            (    free=8MB)
                            (    waste=0MB =0.00%)

-                    Thread (reserved=214MB, committed=26MB)
                            (thread #219)
                            (stack: reserved=213MB, committed=25MB)
                            (malloc=1MB #1316)
...
OMIT SOME LINES HERE 
...

-                  Internal (reserved=10MB, committed=10MB)
                            (malloc=10MB #9058)
-                    Symbol (reserved=44MB, committed=44MB)
                            (malloc=41MB #560526)               --> isn't malloc function backed up by arena under glibc?
                            (arena=2MB #1)                      --> what does this line mean?

-    Native Memory Tracking (reserved=19MB, committed=19MB)
                            (malloc=1MB #7348)
                            (tracking overhead=18MB)

-        Shared class space (reserved=17MB, committed=17MB)
                            (mmap: reserved=17MB, committed=17MB)

-               Arena Chunk (reserved=6MB, committed=6MB).           --> What does this block suggest?
                            (malloc=6MB)

-                    Module (reserved=3MB, committed=3MB)
                            (malloc=3MB #18535)

Take Symbol block for example, what is the difference between malloc and arena? The java application is running on Linux using glibc, so I think (maybe I am wrong) it is arena that actually takes responsibility for memory management. But why is there another separated line below noting memory allocated by arena?

And what does Arena Chunk block mean?
Could you please enlighten me? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪荡不羁 2025-02-20 04:02:42

这与GLIBC竞技场无关。

在热点中,竞技场是用于快速本地内存分配的结构,针对特定模式进行了优化:

  1. 来自竞技场的分配是线程本地的。不涉及同步。
  2. 无法部分回收来自竞技场的记忆。竞技场立即被处置。

竞技场分配的典型用例是JIT汇编。当JIT编译器工作时,它会分配许多小对象(例如IR图节点)。这些对象仅通过一个编译器线程在本地使用。这些临时对象的寿命很短:当方法完成的汇编完成时,整个持有所有这些对象的领域都会立即删除。

竞技场由分配了常规malloc的大块组成。竞技场内的分配是一个简单的指针增量。当竞技场用尽自由空间时,会创建一个新的块。

(AREAA = 2MB#1)在上述NMT报告中意味着符号区域具有一个竞技场,其中包含2MB的一块。

Arena块部分总结了所有活动的竞技场。

This is unrelated to glibc arenas.

In HotSpot, Arena is a structure for fast native memory allocation, optimized for the particular pattern:

  1. Allocation from Arena is thread local. No synchronization is involved.
  2. Memory from an Arena cannot be reclaimed partially. Arena is disposed all at once.

A typical use case for Arena allocation is JIT compilation. When the JIT compiler works, it allocates many small objects (e.g. IR graph nodes). These objects are used locally just by one compiler thread. The life time of these temporary objects is short: when the compilation of a method completes, the entire Arena holding all these objects is deleted at once.

Arena consists of large chunks allocated with a regular malloc. Allocation inside an Arena is a simple pointer increment. When Arena runs out of free space, a new chunk is created.

(arena=2MB #1) in the above NMT report means that the Symbol area has an Arena which includes one chunk of 2MB.

Arena Chunk section summarizes all active Arenas.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文