页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

提示
title使用背景

如何在没有jstack和jmap的情况下打印线程和堆?


操作步骤:

一、下载jattach文件

参考资料:https://github.com/apangin/jattach

访问以上网址,依据实际的操作系统下载对应的jattach文件,比如这里我们下下载了Linux的:jattach

Image Modified

Image Modified

二、上传jattach文件到服务器

将jattach文件上传到服务器任意位置,并赋予可执行权限chmod 777 ./jattach

Image Modified

三、打印线程

./jattach <pid> threaddump

Image Modified

若需要生成文件到指定路径,可输入./jattach <pid> threaddump >> /路径/文件名.txt

四、打印堆栈

./jattach <pid> dumpheap ./test.hprof

Image Modified