JVM dump和分析

原文链接:https://www.dubby.cn/detail.html?id=9098

1、dump

jmap -dump:live,format=b,file=~/Desktop/dump.hprof 1110

其他参数意义:

Usage:
    jmap [option] <pid>
        (to connect to running process)
    jmap [option] <executable <core>
        (to connect to a core file)
    jmap [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    <none>               to print same info as Solaris pmap
    -heap                to print java heap summary
    -histo[:live]        to print histogram of java object heap; if the "live"
                         suboption is specified, only count live objects
    -clstats             to print class loader statistics
    -finalizerinfo       to print information on objects awaiting finalization
    -dump:<dump-options> to dump java heap in hprof binary format
                         dump-options:
                           live         dump only live objects; if not specified,
                                        all objects in the heap are dumped.
                           format=b     binary format
                           file=<file>  dump heap to <file>
                         Example: jmap -dump:live,format=b,file=heap.bin <pid>
    -F                   force. Use with -dump:<dump-options> <pid> or -histo
                         to force a heap dump or histogram when <pid> does not
                         respond. The "live" suboption is not supported
                         in this mode.
    -h | -help           to print this help message
    -J<flag>             to pass <flag> directly to the runtime system

2、分析内存

下载HeapAnalyzer,下载完更名为ha453.jar,执行:

java -jar ha453.jar

打开dump.hprof:

image
image
image
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 懒懒的起床,懒懒的和家人吃了趟鱼,说好的下午开会也没有去了。睡醒后直接去了黑色玫瑰,我也是醉,懒懒的一天就过了。不...
    DeathKnightR阅读 230评论 0 0
  • 文|潇涵 一个人常怀仁人之心是好事,对人、对事能够以最宽容的心态去对待,自己和被善待的人都能会获得精神上的慰藉。但...
    潇涵视界阅读 812评论 2 1
  • 无意中,曾去了浙大参观。说是参观,不过是在梅雨季节里,狼狈地走了走。走了走,在梅雨蒙蒙中,脚踏着积水,头顶着雨伞。...
    郭国酬阅读 662评论 0 3