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 上进行堆转储?


- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01