How can I take a heap dump on Java 5 without garbage collecting first?(如何在不先进行垃圾收集的情况下在 Java 5 上进行堆转储?)
问题描述
我们有一个运行 Java 5 的长期运行的服务器应用程序,对其进行分析我们可以看到老一代随着时间的推移缓慢增长.它在完整的 GC 上被正确释放,但我希望能够使用堆转储查看 Eclipse MAT 中无法访问的对象.我已经使用 +XX:HeapDumpOnCtrlBreak 成功获得了堆转储,但是 JVM 总是在转储堆之前进行 GC.显然这不会发生在 Java 6 上,但我们现在停留在 5 上.有什么办法可以预防吗?
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?
推荐答案
我建议使用 3rd-party profiler,例如 YourKit,它可以让您在不先启动 GC 的情况下拍摄快照.额外的好处是,您可以在没有整个 ctrl-break 恶作剧的情况下拍摄快照.
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 上进行堆转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在不先进行垃圾收集的情况下在 Java 5 上进行堆转储?
基础教程推荐
- 大摇大摆的枚举 2022-01-01
- 多个组件的复杂布局 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 从 python 访问 JVM 2022-01-01
