分析离线 Java 堆转储 (.hprof) 的工具或技巧
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4347518/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tool or tricks to analyze offline Java heap dumps (.hprof)
提问by user331465
Are there any tools that allow offline analysis (including summary/sorting/sifting) of an .hprof file? Or can you run VisualVM, hat etc in batch mode?
是否有任何工具允许对 .hprof 文件进行离线分析(包括汇总/排序/筛选)?或者你可以在批处理模式下运行 VisualVM、hat 等吗?
I'm interested in something that can take an input .hprof file, crunch it and generate reports.
我对可以输入 .hprof 文件、处理它并生成报告的东西感兴趣。
I assume you would need to pass in a bunch of options to configure the report, so if you know any helpful tips, please weigh in.
我假设您需要传入一堆选项来配置报告,所以如果您知道任何有用的提示,请权衡。
Preferably scriptable so I could run a bunch at once.
最好是可编写脚本的,这样我就可以一次运行一堆。
采纳答案by user85155
Eclipse Memory Analyzerdoes everything you need.
Eclipse Memory Analyzer可以满足您的一切需求。
回答by Peter Lawrey
Can you use jmap -histo ? What sort of report are you looking to extract?
你可以使用 jmap -histo 吗?您希望提取什么样的报告?
回答by james
hard to beat yourkit java profiler. It costs money, but it is worth every penny.
很难击败yourkit java profiler。它要花钱,但每一分钱都是值得的。
回答by kohlerm
Es MAT (http://www.eclipse.org/mat/) is the way to go. Check http://kohlerm.blogspot.com/search/label/memory, especially http://kohlerm.blogspot.com/2009/07/eclipse-memory-analyzer-10-useful.html
Es MAT (http://www.eclipse.org/mat/) 是要走的路。检查http://kohlrm.blogspot.com/search/label/memory,尤其是http://kohlrm.blogspot.com/2009/07/eclipse-memory-analyzer-10-useful.html
回答by robbin
JDK6 comes with jhat which parses and creates an html report.
JDK6 带有 jhat,它解析并创建一个 html 报告。
http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html
http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html