How to view memory allocation stacktrace in Java V

2020-02-10 13:07发布

问题:

This article describes how to view memory allocation stacktrace in 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" checkbox in the memory settings tab.

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.

How can I view these allocation stack traces?

回答1:

Enable Memory profiling in Sampler tab, then press a Heap Dump button.



回答2:

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.