- I had the Apache Tomcat running on my machine, so i tested it if the application was running ok.
The next step was to execute
jvisualvmcommand which is part of JDK.
- It brought up Java VisualVM like this, as you can see it shows you every Java application that is running on your machine, including tomcat
- Then double click on the Tomcat process and it opens the details like this, As you can see i dont have to set any JVM flags but could attach the VisualVM directly
- The monitor tab gives you high level information about the VM like how its doing on memory and threads,.. etc. It also has Heap Dump button, when you click on it, That generates Heap Dump. By default the heap dump goes to
/var/folders/..folder. So right click on the Heap Dump related node and click on Save As and save it somewhere else on your disk. Then you can use Eclipse MAT to analyze the dump
Debugging Tomcat memory leak using java VisualVM
Recently i was trying to debug a memory leak in the Web Application deployed in Apache Tomcat, i wanted to figure out how the JVM memory was doing. For that i decided to use Java VisualVM and it turns out that is pretty easy to use and very powerful.