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
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
