Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find classloader leak with free tools?

I'm investigating a memory leak in a Tomcat/Spring/Hibernate app which is causing the dreaded "out of permgen" error after a few redployments. I've downloaded the free version of plumbr, which confirms that I have a classloader leak, but unfortunately I can't afford the $499 to get the detailed report. Is there a free tool that can perform an equivalent analysis and tell me where to look for it? Or some other common cause of such leaks that I can investigate?

Steps I've taken so far:

  • Ensure my JDBC driver is unregistered at context shutdown
  • Manually shut down the MySQL driver's AbandonedConnectionCleanupThread (per Tomcat Guice/JDBC Memory Leak)

What else might be causing the leak?

like image 230
Jules Avatar asked Feb 23 '14 09:02

Jules


1 Answers

You can use the evaluation version of JProfiler to investigate the class loader leak. Go to the class loader probe, select one of the leaking class loaders and show them in the heap walker where you can investigate strong references to the classes that were loaded by the class loader.

There is a screen cast that shows you how to do this.

Disclaimer: My company develops JProfiler.

like image 188
Ingo Kegel Avatar answered Sep 21 '22 11:09

Ingo Kegel