Capture Heap dump from Tomcat Windows Service
Add the following options into Tomcat Java Options to enable heap dump capture:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=C:/heapdumps
Steps to capture heap dump manually:
- Go to JAVA_HOME/bin directory and launch jconsole.exe application
- In the remote process box enter localhost:8086 and click Connect button
- Switch to the MBeans tab
- Select com.sun.management → HotSpotDiagnostic → Operations → dumpHeap in the tree
- Enter the dump file path and click dumpHeap button
The heap dump file can then be analyzed using tools like Eclipse MAT or VisualVM.