March 20, 2012

Memory Profiling Tool with Allocation Stack Trace

Hunting down memory consuming code, cannot be done without a good tool. Because guising which method or code block that consumes most memory, is at least according to me, almost impossible.

And one good tool that comes for free is Visual VM (http://visualvm.java.net/) If you are running Windows and Java SDK you already have it installed under
$ %JAVA_HOME%/bin/jvisualvm

And if you are running Ubuntu, simply install with:
$ sudo apt-get install visualvm

The tool is quite straight forward. You can see working thread and do thread dump to see what each thread is momentarily is doing, etc. And from the Profile tab you can perform memory profiling, but to see allocations stack trace you have to change the default settings.

No comments: