title: Java Class (PermGen) Memory Leak (Web Applications) - Generic Solution?
body: <p>I have a perm gen memory leak, that I know. Profiling using jvisualvm shows that when doing hot deployment (e.g. stop and start an application without killing the JVM, in tomcat, WebSphere, WebLogic etc) - the PermGen space is constantly increasing.</p>
  
  <p>After reading, using jhat, and other advanced tools I realized that I probably have a reference to the <code>WebAppClassLoader</code> from a class somewhere in its parent class loaders.</p>
  
  <p>I couldn't pin it down even though I did some massive JavaScript based queries on jhat</p>
  
  <p>Isn't there a simple utility that finds out who is responsible for you class loader to not be garbage collected (thus allowing garbage collection of classes loaded by it)? </p>
  
  <p>I tried JProfiler, jvisualvm, jhat, and a lot of Google</p>
  
  <p>to all the LMGTFY friends - I've spent about a day and a half reading forums with step by steps instructions, no luck. I'm looking for a utility or code that outputs:</p>
  
  <p>Object X of class Y is the sole GC root that keeps your classes from being removed.</p>