Thoughts on systems, software, and what actually matters.
Capture Heap dump from Tomcat Windows Service

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:

  1. Go to JAVA_HOME/bin directory and launch jconsole.exe application
  2. In the remote process box enter localhost:8086 and click Connect button
  3. Switch to the MBeans tab
  4. Select com.sun.management → HotSpotDiagnostic → Operations → dumpHeap in the tree
  5. Enter the dump file path and click dumpHeap button

The heap dump file can then be analyzed using tools like Eclipse MAT or VisualVM.