Java 堆转储 - jsm-所有GC.heap_dump

发布于 2025-01-10 09:36:33 字数 460 浏览 4 评论 0原文

根据文档,jcmd 命令没有 -all 选项。 https://docs.oracle.com/javase/ 8/docs/technotes/guides/troubleshoot/tooldescr006.html

  1. 使用 -all 选项执行 jcmd。 GC没有触发,GC日志中看不到【Full GC(Heap Dump Initiated GC)。

  2. 使用 -all 选项执行 jcmd。 GC被触发,可以在GC日志中看到【Full GC(Heap Dump Initiated GC)。

-all 选项是否有任何特定行为且文档中未提及。

There is no -all option for jcmd command as per documentation.
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html

  1. execute jcmd with -all option. GC is not triggered and can not see [Full GC (Heap Dump Initiated GC) in GC logs.

  2. execute jcmd with -all option. GC is triggered and can see [Full GC (Heap Dump Initiated GC) in GC logs.

Is there any specific behaviour with -all option and not mentioned in documentation.

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

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

发布评论

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

评论(1

养猫人 2025-01-17 09:36:33

要获取有关 jcmd(子)命令的帮助,请使用“help command”,但请注意,您仍然必须指定 pid 以满足 jcmd 的正式命令行模式,即

jcmd 0 help GC.heap_dump

打印

GC.heap_dump
Generate a HPROF format dump of the Java heap.

Impact: High: Depends on Java heap size and content. Request a full GC unless the '-all' option is specified.

Permission: java.lang.management.ManagementPermission(monitor)

Syntax : GC.heap_dump [options] <filename>

Arguments:
        filename :  Name of the dump file (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
        -all : [optional] Dump all objects, including unreachable objects (BOOLEAN, false)
        -gz : [optional] If specified, the heap dump is written in gzipped format using the given compression level. 1 (recommended) is the fastest, 9 the strongest compression. (INT, 1)

(使用JDK 17.0.2+8测试)

To get help on a jcmd (sub)command, use “help command”, but note that you still have to specify a pid to meet jcmd’s formal command line pattern, i.e.

jcmd 0 help GC.heap_dump

which prints

GC.heap_dump
Generate a HPROF format dump of the Java heap.

Impact: High: Depends on Java heap size and content. Request a full GC unless the '-all' option is specified.

Permission: java.lang.management.ManagementPermission(monitor)

Syntax : GC.heap_dump [options] <filename>

Arguments:
        filename :  Name of the dump file (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
        -all : [optional] Dump all objects, including unreachable objects (BOOLEAN, false)
        -gz : [optional] If specified, the heap dump is written in gzipped format using the given compression level. 1 (recommended) is the fastest, 9 the strongest compression. (INT, 1)

(tested with JDK 17.0.2+8)

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