2022-07-15 22:37:32 +08:00
|
|
|
# heapdump
|
2019-09-03 16:46:52 +08:00
|
|
|
|
2020-08-07 18:28:00 +08:00
|
|
|
[`heapdump`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-heapdump)
|
2020-08-07 17:50:16 +08:00
|
|
|
|
2022-07-15 22:37:32 +08:00
|
|
|
::: tip
|
|
|
|
dump java heap, 类似 jmap 命令的 heap dump 功能。
|
|
|
|
:::
|
2019-09-03 16:46:52 +08:00
|
|
|
|
2022-08-09 18:42:39 +08:00
|
|
|
## 使用参考
|
2019-09-03 16:46:52 +08:00
|
|
|
|
2022-08-09 18:42:39 +08:00
|
|
|
### dump 到指定文件
|
2019-09-03 16:46:52 +08:00
|
|
|
|
|
|
|
```bash
|
2023-04-19 15:22:33 +08:00
|
|
|
[arthas@58205]$ heapdump arthas-output/dump.hprof
|
|
|
|
Dumping heap to arthas-output/dump.hprof ...
|
2019-09-03 16:46:52 +08:00
|
|
|
Heap dump file created
|
|
|
|
```
|
|
|
|
|
2023-04-19 15:35:06 +08:00
|
|
|
::: tip
|
|
|
|
生成文件在`arthas-output`目录,可以通过浏览器下载: http://localhost:8563/arthas-output/
|
|
|
|
:::
|
2023-04-19 19:32:31 +08:00
|
|
|
|
2022-08-09 18:42:39 +08:00
|
|
|
### 只 dump live 对象
|
2019-09-03 16:46:52 +08:00
|
|
|
|
|
|
|
```bash
|
2023-04-19 15:35:06 +08:00
|
|
|
[arthas@58205]$ heapdump --live /tmp/dump.hprof
|
|
|
|
Dumping heap to /tmp/dump.hprof ...
|
2019-09-03 16:46:52 +08:00
|
|
|
Heap dump file created
|
|
|
|
```
|
|
|
|
|
2022-08-09 18:42:39 +08:00
|
|
|
## dump 到临时文件
|
2019-09-03 16:46:52 +08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
[arthas@58205]$ heapdump
|
|
|
|
Dumping heap to /var/folders/my/wy7c9w9j5732xbkcyt1mb4g40000gp/T/heapdump2019-09-03-16-385121018449645518991.hprof...
|
|
|
|
Heap dump file created
|
|
|
|
```
|