openj9分析dmp文件

简介

dmp文件是系统转储,系统转储包括堆地址空间进行转储,此类转储一般都非常大。

应用程序占用空间越大,其转储文件也会越大。基于主服务器的应用程序的转储文件可能会占用许多兆字节的文件空间,并且需要几分钟才能完成。

如何生成

jvm通过以下参数控制dmp文件在内存溢出时生成,已在jvm默认配置:

 
JAVA_OPTS=" -Xdump:system:events=systhrow,filter=java/lang/OutOfMemoryError,label=$program_inst_log_dir/core-$nodename-$date_time_string.%seq.dmp,range=1..1,priority=999,request=exclusive+compact+prepwalk"

 

dmp阅读

如何分析dmp文件,有两种方式

  1. 下载 mat,解压第一个压缩包,启动mat并打开该文件,分析方法与phd和hrof文件一样。

  2. 使用jdmpview工具,参考文档:https://www.eclipse.org/openj9/docs/tool_jdmpview/ 

 

使用mat

能看到对象包含的具体信息,String值等

image.png

image.png

使用jdmpview

下面演示一个如何使用jdmpview工具查看dmp信息的示例,使用jdmpview,首先要确保dmp文件所在的环境安装了openj9,下面以windows为例,openj9安装在D:\Home\java\jdk8u181-b13目录下

  1. 执行命令D:\Home\java\jdk8u181-b13\bin\jdmpview -core core-dump-2019-01-19-05-38-35.0001.dmp

    image.png

    2.在生成的栏目中输入help命令,即可查看jdmpview所支持的所有命令以及说明。参照使用即可

 

    image.png

    3.jdmpview所支持的命令

 

> help

+                                              displays the next section of memory in hexdump-like format

-                                              displays the previous section of memory in hexdump-like format

cd                                             changes the current working directory, used for log files

close                     [context id]         closes the connection to a core file

context                   [ID|asid ID]         switch to the selected context

deadlock                                       displays information about deadlocks if there are any

exit                                           Exit the application

find                                           searches memory for a given string

findnext                                       finds the next instance of the last string passed to "find"

findptr                                        searches memory for the given pointer

heapdump                                       generates a PHD or classic format heapdump

help                      [command name]       displays list of commands or help for a specific command

hexdump                   <hex address>        outputs a section of memory in hexadecimal, ascii and ebcdic

info                      <component>          Information about the specified component

info class                [Java class name] [-sort:<name|count|size>] Provides information about the specified Java class

info heap                 [*|heap name]        Displays information about Java heaps

info jitm                                      Displays JIT'ed methods and their addresses

info lock                                      outputs a list of system monitors and locked objects

info memory                                    Provides information about the native memory usage in the Java Virtual Machine

info mmap                 [address] [-verbose] [-sort:<size|address>] Outputs a list of all memory segments in the address space

info mod                                       outputs module information

info proc                                      shortened form of info process

info process                                   displays threads, command line arguments, environment

info sym                                       an alias for 'mod'

info sys                                       shortened form of info system

info system                                    displays information about the system the core dump is from

info thread               [<native thread ID>|<zOS TCB>|all|*] Displays information about Java and native threads

log                       [name level]         display and control instances of java.util.logging.Logger

open                      [path to core or zip] opens the specified core or zip file

plugins                                        Plugin management commands

                     list                      Show the list of loaded plugins for the current context

                   reload                      Reload plugins for the current context

                 showpath                      Show the DTFJ View plugin search path for the current context

                  setpath                      Set the DTFJ View plugin search path for the current context

pwd                                            displays the current working directory

quit                                           Exit the application

set                       [logging|heapdump]   Sets options for the specified command

set heapdump                                   configures heapdump format, filename and multiple heap support

set logging                                    configures several logging-related parameters, starts/stops logging

                       on                      turn on logging

                      off                      turn off logging

                     file                      turn on logging

                overwrite                      controls the overwriting of log files

show                      [logging|heapdump]   Displays the current set options for a command

show heapdump                                  displays heapdump settings

show logging                                   shows the current logging options

whatis                    [hex address]        gives information about what is stored at the given memory address

x/d                       <hex address>        displays the integer at the specified address

x/j                       <object address> | <class name> displays information about a particular object or all objects of a class

x/k                       <hex address>        displays the specified memory section as if it were a stack frame parameters

x/x                       <hex address>        displays the hex value of the bytes at the specified address

history                   [-r] [N]                  If option -r is used, the Nth history command (default to the last one) will be run;

     otherwise, at most N (default 20) history commands will be displayed.

grep                      [options] <pattern>  to be used after the pipeline to show lines which match a pattern.

charsfrom                 [options] <pattern>  To be used after a pipeline to remove the characters before a pattern in a line.

charsTo                   [options] <pattern>  To be used after a pipeline to keep the characters from a line until a specific pattern is found.

>|>>                      <targetFilePath>     to be used at the end of a command to redirect messages to a file (overwrite|append).

cmdfile                   <commandFilePath> [charset] To execute all the commands in a file.

tokens                    [-keep] <range>[,<range>...] To be used after a pipeline to pick up tokens in a line.

>

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值