zoukankan      html  css  js  c++  java
  • MAT(3)获取dump文件

    方式一:遇错时自动生成(添加启动参数)

    -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=E:Javadump

    生成的文件例如:java_pid2080.hprof

    方式二:运行时主动生成(jmap命令)

    jmap -J-d64 -dump:format=b,file=E:Javadumpd1.hprof 7992 

    生成的文件例如:d1.phrof

    语法:

    jmap [ option ] pid

    window  打开任务管理器 - 进程 - 找到对应PID (如果表中没有,可 “查看 - 选择列 - PID " 展示 )

    linux 使用命令 ps -ef 查找PID

    -J<flag> Passes <flag> to the Java virtual machine on which jmap is run.

    -J-d64 Means the given process is running on a 64-bit VM

    -dump:[live,]format=b,file=<filename> Dumps the Java heap in hprof binary format to filename.

    常见错误:

    如果PID不正确则如下

    20520: no such process

    如果file指定的是一个已存在的文件夹而不是文件则如下

    # 其中dump是一个已存在的文件夹
    Dumping heap to E:Javadump ...
    Permission denied

     hprof 由来:

    The Java 2 Platform Standard Edition (J2SE) has always provided a simple command line profiling tool called HPROF for heap and cpu profiling.

    Heap profile 工具生成的文件的格式就是 (*.hprof)

    点击查看详细语法

  • 相关阅读:
    本周总结
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    Hibernate中session.createCriteria的用法
    Spring AOP 源码分析
    TCP的三次握手四次挥手
  • 原文地址:https://www.cnblogs.com/zno2/p/4607547.html
Copyright © 2011-2022 走看看