如何在 Java VisualVM 中查看内存分配堆栈跟踪
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12017529/
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
How to view memory allocation stacktrace in Java VisualVM
提问by sina72
This article describes how to view memory allocation stacktrace in Java VisualVM: http://rejeev.blogspot.de/2009/04/analyzing-memory-leak-in-java.html
本文介绍如何在Java VisualVM中查看内存分配堆栈跟踪:http: //rejeev.blogspot.de/2009/04/analyzing-memory-leak-in-java.html
In short, define a custom preset in the Java VisualVM options and check the "record allocations stack traces" checkboxin the memory settings tab.
简而言之,在 Java VisualVM 选项中定义自定义预设并选中内存设置选项卡中的“记录分配堆栈跟踪”复选框。
Now, when I select that custom preset and start memory profiling, I still cannot view the memory allocation stacktrace. There is no right-click-on-item action "Take snapshot and show allocation stack traces"as described in the article, nor a anything like that. I am using VisualVM 1.7.
现在,当我选择该自定义预设并启动内存分析时,我仍然无法查看内存分配堆栈跟踪。没有文章中描述的右键单击项目操作“拍摄快照并显示分配堆栈跟踪”,也没有类似的操作。我正在使用 VisualVM 1.7。
How can I view these allocation stack traces?
如何查看这些分配堆栈跟踪?
采纳答案by jkee
Enable Memoryprofiling in Samplertab, then press a Heap Dumpbutton.
在Sampler选项卡中启用内存分析,然后按下Heap Dump按钮。
回答by Peter Clause
If you can't see this option, go to Profiler -> activate "Settings" check box and activate "Record allocation stack traces" while the profiler is not active.
如果您看不到此选项,请转到 Profiler -> 激活“设置”复选框,并在 Profiler 未激活时激活“记录分配堆栈跟踪”。