September 2010 Archives

Java’s visualvm tool run with the command jvisualvm is amazing. You can use it to monitor threads and do some digging into heap dumps from crashed VMs.

Like so many tools adapted from other projects, though, it has some quirks. One of these is in the form of a very cryptic error message you may see when digging through a large heap dump: Out of memory in HeapWalker - To avoid this error, increase the -Xmx value in the etc/netbeans.conf file in the NetBeans IDE installation directory.

Java VisualVM.jpg

The default configuration has a very small heap size which is simply not big enough for useful heap debugging. To make matters worse, there is no netbeans.conf!

The configuration parameter you are actually looking for is the default_options option in the visualvm.conf file. In that property you’ll see some JVM parameters including -J-Xmx=192m which you are free to tweak.

On my mac running OS X 10.6 Snow Leopard I found this file here /System/Library/Frameworks/JavaVM.framework/Resources/VisualVM.bundle/Contents/Home but I suspect you’ll find it on other platforms in ../etc/visualvm.conf relative to the jvisualvm command itself.