Java VisualVM在OOME上启用堆转储 [英] Java VisualVM Enable Heap Dump on OOME

查看:157
本文介绍了Java VisualVM在OOME上启用堆转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档,可以自动当应用程序遇到OutOfMemoryException时进行堆转储。

OutOfMemoryException进程刚从左侧菜单中消失。

此功能在VisualVM中如何工作?

According to documentation one could automatically take a heap dump when the application encounters an OutOfMemoryException.
After OutOfMemoryException process just disappear from left menu.
How does this feature works in VisualVM?

谢谢。

C:\ work \ temp> java -XX:HeapDumpPath = c:/work/temp/file.hprof -XX:+ HeapDumpOnOutOfMemoryError -jar example.jar

C:\work\temp>java -XX:HeapDumpPath=c:/work/temp/file.hprof -XX:+HeapDumpOnOutOfMemoryError -jar example.jar

推荐答案

据我所知,JVisualVM中的该选项相当于将 -XX:+ HeapDumpOnOutOfMemoryError 指定为JVM参数。这会导致JVM在遇到OutOfMemoryError时创建堆转储文件。然后可以将此文件加载到JVisualVM(或分析器)并在那里进行分析。存储文件的目录由 -XX:HeapDumpPath 参数定义。

As far as I know, that option in JVisualVM is equivalent to specifying -XX:+HeapDumpOnOutOfMemoryError as a JVM parameter. This causes the JVM to create a heap dump file when it encounters an OutOfMemoryError. This file can be then loaded into JVisualVM (or into a profiler) and analyzed there. The directory where the file is stored is defined by the -XX:HeapDumpPath parameter.

另请参阅:

  • Troubleshooting Guide for Java SE 6 with HotSpot VM
  • Java HotSpot VM Options
  • StackOverflow: Using HeapDumpOnOutOfMemoryError parameter

这篇关于Java VisualVM在OOME上启用堆转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆