Friday, July 16, 2021

How to Take a Heap Dump from Tomcat : Windows

 Hi All, 

This post is to quickly check how to take a heap dump from Tomcat running on Windows machine. 

  1. First open a command prompt running as Administrator
  2. First we have to find the process ID of running Tomcat. For that it would be easy to know the Tomcat running port. In my case it's 8081. Therefore I'll execute the following command. 

    > netstat -ano | findstr 8081


  3. Create a folder to store the dump file
  4. Execute the following command.

     jmap -dump:file=E:\dump\myheapfump.hprof -F <process_id>



  5. Now you can analyze the heapdump using a tool like eclipse memory analyzer 

Hope that helps, 
Thanks. 

No comments:

Post a Comment