tags:

views:

927

answers:

3

Are there any good tools available to track memory usage In a tomcat java webapp? I'm looking for something that can give a breakdown by class or package.

Thanks, J

+2  A: 

jconsole can give you summary statistics. I've used it in the past while load testing to infer the size of loaded classes (by noting the before and after usage when loading LOTS of objects.) Note that the usage keeps going UP until a garbage collection is triggered, so you will need to account for transient objects in your calculations.

Chris Nava
+1  A: 
Kire Haglin
+3  A: 

I use the Netbeans IDE and it is able to profile any type of Java project including webapps. Once you have the project setup in Netbeans you just click Profile and answer a few easy questions.

It is very easy to create a new project and import your existing code into it.

You can see screenshots of this here: http://profiler.netbeans.org/

You can download Netbeans from here: http://www.netbeans.org/

VisualVM may also work for you. There are also a number of plugins available for it. VisualVM has been shipping with the JDK since JDK 6 update 7. You can check it out here: https://visualvm.dev.java.net/

sjbotha