Java App Profiling: jconsole and heapdumps
jconsole is a cool tool part of 1.6 that can be found in <jdk>/bin. You can connect to local running processes or connect to remote applications usually on port 1099. You can monitor CPU, memory, threads. To perform a heap dump, go to MBeans tab > com.sun.management > HotSpotDiagnostic > Operations.
Input a file location plus the file name in p0 parameter. ex. d:\temp\mydumps\heap.dump.out.
To read this dump you’ll use the built in jhat tool. ex: jhat heap.dump.out to browse through class usage.