是否有工具可以分析大型 Java 堆转储而不加载完整的 hprof 文件?
我使用 Eclipse MAT 来分析 hprof 文件。这非常好,但如果您有 2Gb 堆转储,那么您需要使用 2Gb+ 堆大小本身运行 MAT,以便能够加载完整的堆转储。
我想知道是否有人知道一个工具可以分析 2Gb hprof 文件而不使用那么多内存本身(例如,它不加载完整的文件,但以某种方式遍历它)?如果在客户服务器上生成 hprof 文件,这将很有用,因为我可以在服务器上运行一些分析,而不是尝试通过 VPN 复制 2Gb 文件。
I use Eclipse MAT to analyse hprof files. It is very good but if you have a 2Gb heap dump then you need to run MAT with a 2Gb+ heap size itself to be able to load the complete heap dump.
I was wondering if anyone knows of a tool that could analyse a 2Gb hprof file without using that much memory itself (e.g. it doesn't load the complete file but somehow walks through it)? This would be useful if a hprof file gets generated on a customer server as I could then run some analysis on the server instead of trying to copy a 2Gb file over a VPN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
hprof 文件的格式如果不完全加载并随后应用一些交叉引用,则无法正常工作。
但是,您可以使用包含的
jmap
、jstack
和visualvm
跳过 hprof 转储,仅从正在运行的 VM 获取基本信息在JDK包中。例如,典型的内存泄漏应该已经从 jmap 堆直方图中可见,因为您只需查看特定类的实例数量就可以猜测生成或保留对象的位置。
hprof files have a format that doesn't really work well without loading it fully and then applying some cross-referencing afterwards.
However, you may be able to skip the hprof dump to get just basic information from the running VM by using
jmap
,jstack
, andvisualvm
included in the JDK package.Typical memory leaks for example should be visible from the jmap heap histogram already, as you might be able to guess the places that produce or retain objects just by looking at the number of instances of a particular class.
最新版本的 YourKit 处理大型堆转储的能力比以前好得多。我已经取得了很好的成功,并强烈推荐它。很久以前,Virag Saksena 有一个名为 Auptyma 的工具,但看来它可能已经被 Oracle 收购了。
The latest versions of YourKit handle large heap dumps much better than before. I've had good success with it and highly recommend it. A long time ago there was a tool called Auptyma by Virag Saksena, but it appears that it may have been bought by Oracle.