是否有可能为垃圾收集“查看”对象图? [英] Is it possible to 'see' the object graph for garbage collection?

查看:83
本文介绍了是否有可能为垃圾收集“查看”对象图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在泄漏内存的Java应用程序。我知道哪些对象在垃圾回收期间没有被释放,但我无法弄清楚引用它们的是什么。

I have a Java application that is leaking memory. I know which objects are not being freed during garbage collection, but I can't work out what is referencing them.

是否有可能具有某种可见性JVM中内部保存的对象图表是什么?

Is it at all possible to have some sort of visibility of the object graph that is being held internally by the JVM?

它可能找出哪些对象正在引用另一个对象?

It is at all otherwise possible to find out which objects are referencing another object?

推荐答案

在真正基础的层面上,您可以使用命令jhat和jmap从正在运行的Java进程读取堆文件,然后对其进行处理 - 本地端口上的小型Web服务器。阅读起来并不容易,但您不必购买分析器即可使用它。

On a really basic level, you can use the commands jhat and jmap to read a heap file from a running Java process and then process it - it starts a small web server on a local port. It's not exactly easy to read, but you don't have to buy a profiler to use it.

这篇关于是否有可能为垃圾收集“查看”对象图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆