How to create a heap dump on Tomcat on Linux

Home > Search > How-to
  by

Let's say you want to create a heap dump of a running Tomcat JVM. First, you will need to get the PID of the Tomcat JVM. On Linux, this can be done using the ps command. In this example, the PID of the JVM is 12345.

~]# ps -ef | grep jvm_name
root  12345  . . . 

 

The jmap command can be used to create a heap dump. jmap is a command line tool included with Java. Following is the basic syntax of the jmap command. The PID of the JVM (12345 in this example) is used to create a heap dump of the running Tomcat JVM. This will create a file named heapdump.hprof in the /tmp directory.

java_home/bin/jmap -dump:format=b,file=/tmp/heapdump.hprof 12345

 

Once the heapdump file has been created, then you can analyze the heap dump.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments