Simple OutOfMemoryError profiling with VisualVM
Today I used Java heap profiling to investigate a problem with Scala futures.
Start your Java program with the following options. I used a maximum heap size of 32 megabytes to speed up the error. When an OutOfMemoryError occurs, a heap profile file will be dumped.
Start VisualVM. On Mac OS 10.8 it is located at the following location:
Choose File > Load and open the heap profile (hprof) file.
You'll be presented with a summary of class memory usage.