views:

82

answers:

4

I'm trying to find memory leaks and performance issues with my java application. Is there a program out there that can help me debug my application and display performance results?

Thanks.

+4  A: 

Have a look at jvisualvm in the JDK - a subset of the Netbeans profiler - which can attach to a running Java 6 process and allow you to profile it and do memory analysis.

https://visualvm.dev.java.net/gettingstarted.html

Thorbjørn Ravn Andersen
Yes. JVisualVM is absolutely the best tool for visualizing and debugging memory leaks in Java.
Daniel Pryden
Thank you so much for this! This is exactly what I am looking for:) You saved me SO MUCH TIME!!!Thank you man thank you!
Kyle
Not necessarily, but being part of the JDK makes it a good starting place.
Thorbjørn Ravn Andersen
@Kyle, you are welcome. There are more tools in the JDK which are nice to know, but they are more low level than visualvm.
Thorbjørn Ravn Andersen
A: 

Eclipse has a good memory dump analyzer; but finding a memory leak can be very challenging and requires you to dive deeply into the way the objects are allocated by your application.

It took me 2 full days to figure out that one of my custom JTable cell editor classes was allocating a JDialog upon instantiation, without actually opening it, and the native part of the dialog kept the cell editor instance locked, thus the table, thus the screen and thus all entity objects that were associated with it.

Tbee
+1  A: 

I used a lot of tools to find why my program eats 100+ Mb of ram, polished the code to remove any possible memory leaks. Later I found that once jvm took some memory from the OS, I doesn't always return it, even if that memory is not used, which often looks like a memory leak. This depends on -Xmx and -XX:MaxHeapFreeRatio. I set Xmx to 40 which is roughly how much memory my app should use, and memory usage stays within 10-15 Mb of this range instead of increasing uncontrollably.

Also, jconsole is a great tool. It comes with jdk.

tulskiy
A: 

You can try performance inspector tool.Following is the URL.

http://perfinsp.sourceforge.net/

Java Application performance is directly proportional to how JVM is running your application. This tool gives very good profiling information about JVM.But its not a graphical tool,you need to go through the text file generated. But its one time effort and you can get handy with this tool.I used it many time for performance related issues and it helped me lot.

Anil Vishnoi