简体   繁体   English

Java Eclipse在断点上创建堆转储

[英]Java Eclipse Create Heap-Dump on Breakpoint

How do I make a heapdump at a breakpoint in eclipse? 如何在eclipse的断点创建一个dumpdump?

My Java program has 2 versions that do the same thing with 2 different methods. 我的Java程序有2个版本,它们使用2种不同的方法来完成相同的任务。
One of these methods runs into a Heap Space Exception but the other doesn't. 其中一种方法遇到堆空间异常,而另一种则没有。

I was able to get the heapdump for the one that encountered an error by setting the VM argument -XX:+HeapDumpOnOutOfMemoryError 我可以通过设置VM参数-XX:+ HeapDumpOnOutOfMemoryError获得遇到错误的堆转储。

For the program using the method that doesn't get the error, I want to get a heapdump at a certain breakpoint. 对于使用不会出错的方法的程序,我想在某个断点处获得一个堆转储。 How can I do this? 我怎样才能做到这一点?

  1. Install Eclipse memory analyzer plug in 安装Eclipse内存分析器插件
  2. Set your debug point and start your application in debug mode and reach to the point where you would like to take Heap-Dump. 设置调试点并以调试模式启动应用程序,然后到达要进行堆转储的位置。
  3. Go to Memory Analysis perspective (Once you install plug-in you will find this perspective) 转到“内存分析”透视图(一旦安装了插件,您将找到此透视图)

记忆分析的观点

  1. Then click on Acquire Heap Dump button and you will get all head dumps till that debug point. 然后单击“获取堆转储”按钮,您将获得所有头转储,直到该调试点为止。

获取堆转储

您始终可以使用jvisualvm连接到该进程,然后右键单击并进行堆转储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM