gpt4 book ai didi

java - 如何使用 jdk 11 读取堆状态?

转载 作者:行者123 更新时间:2023-11-30 10:05:00 26 4
gpt4 key购买 nike

对于 jdk 8,这些是我计算进程运行时消耗了多少内存的步骤:

/usr/java/latest/bin>: ./jps

27116 Main
7591 Jps
2879 AmbusProcessor

然后拿起进程ID来检查堆的状态:

/usr/java/latest/bin>: ./jmap -heap 2879  



Attaching to process ID 2879, please wait...

Debugger attached successfully.
Server compiler detected.
JVM version is 24.45-b08
using thread-local object allocation.
Parallel GC with 13 thread(s)

Heap Configuration:

MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 68719476736 (65536.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 134217728 (128.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:

PS Young Generation

Eden Space:
capacity = 15427698688 (14713.0MB)
used = 9122094480 (8699.507217407227MB)
free = 6305604208 (6013.492782592773MB)
59.128031111311266% used

From Space:

capacity = 2062024704 (1966.5MB)
used = 813973552 (776.2656707763672MB)
free = 1248051152 (1190.2343292236328MB)
39.474481097196396% used

To Space:

capacity = 1944059904 (1854.0MB)
used = 0 (0.0MB)
free = 1944059904 (1854.0MB)
0.0% used

PS Old Generation

capacity = 8520204288 (8125.5MB)
used = 6649238896 (6341.208358764648MB)
free = 1870965392 (1784.2916412353516MB)
78.04083882548333% used

PS Perm Generation

capacity = 31981568 (30.5MB)
used = 16156728 (15.408256530761719MB)
free = 15824840 (15.091743469238281MB)
50.518873871349896% used

6141 interned Strings occupying 609896 bytes.

我正在寻找一种方法来读取状态,应该类似于上面的示例,但是,没有找到与 openjdk 11 类似的选项。我已经在 openjdk11 上的 jmap 上尝试了所有可能的选项。还有办法用 openjdk11 获得那种状态读取吗?我正试图在内存不足时准确转储

最佳答案

对于 JDK 11 等较新的 Java 版本,您可以使用此命令:

jhsdb jmap --heap --pid <pid>

输出几乎与 Java 8 和 jmap 相同。

关于java - 如何使用 jdk 11 读取堆状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55525449/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com