从应用程序内请求Java堆转储(核心转储) [英] Request java heap dump (core dump) from within application

查看:148
本文介绍了从应用程序内请求Java堆转储(核心转储)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法从应用程序中请求堆转储

I need a way to request a heap dump from within the application.

基本原理:遇到特定错误情况时,我'我想转储堆,这样我就能看到内存中的内容。

Rationale: When I encounter a specific error condition, I'd like to dump heap, so that I can see what is holding on to the memory.

但是我想自动化这个(例如,当我检测到时已经发生了一些特定的情况。或者当看门狗不再获得它的ping时。当某些测试失败时)。因此,我需要一种从应用程序本身转储堆的方法。我似乎无法用MX bean找到它。虽然MX Beans可以提供非常好的堆栈跟踪以及监视器和可拥有的同步器信息,死锁和争用信息,但我似乎无法找到请求堆转储的方法。有没有这样的方式?或者通过一些间接方式,例如,这些JVisualVM事情是如何做到的?并且可以告诉JVM在OutOfMemoryExceptions上转储核心。?

But I would like to automate this (For example, when I detect that some specific condition has occurred. Or when a watchdog doesn't gets its pings anymore. When some test fails). Thus I need a way to dump the heap from within the application itself. I can't seem to find it with the MX beans stuff. Although the MX Beans can give very nice stack traces with monitor and "ownable synchronizer" info, deadlock and contention info, I can't seem to find a way to request a heap dump. Are there any such way? Or by some indirect means, for example how does these JVisualVM things do it? And one can tell the JVM to dump core on OutOfMemoryExceptions..?

推荐答案

如果它不足以转储堆 OutOfMemoryError ,有一个依赖于HotSpot的方式如果没有问题,请以编程方式从Java应用程序中转储堆

这篇关于从应用程序内请求Java堆转储(核心转储)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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