本文介绍了如何在不使用垃圾收集的情况下在Java 5上进行堆转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个运行Java 5的长时间运行的服务器应用程序,并且通过分析我们可以看到,随着时间的推移,老一代增长缓慢。它在一个完整的GC上正确释放,但我希望能够使用堆转储查看Eclipse MAT中不可访问的对象。我已经使用+ XX:HeapDumpOnCtrlBreak成功获得堆转储,但JVM在转储堆之前始终执行GC。显然这不会发生在Java 6上,但现在我们被困在了5上。有没有什么办法可以防止这种情况发生?

解决方案我建议使用第三方分析器,例如,这可能允许您在不首先启动GC的情况下拍摄快照。额外的奖励,你可以在没有整个ctrl-break shenanigans的情况下拍摄快照。


We have a long running server application running Java 5, and profiling it we can see the old generation growing slowly over time. It's correctly freed on a full GC, but I'd like to be able to look at the unreachable objects in Eclipse MAT using a heap dump. I've successfully obtained a heap dump using +XX:HeapDumpOnCtrlBreak, but the JVM always does a GC before dumping the heap. Apparently this doesn't happen on Java 6 but we're stuck on 5 for now. Is there any way to prevent this?

解决方案

I suggest a 3rd-party profiler such as YourKit, which may allow you to take snapshots without kicking off the GC first. Added bonus, you can take a snapshot without the whole ctrl-break shenanigans.

这篇关于如何在不使用垃圾收集的情况下在Java 5上进行堆转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 08:17
查看更多