title: Tomcat WebappClassloader not garbage collected
body: <p>I'm trying to track down a memory leak in my web application which is causing the PermGen space to fill up and throw OutOfMemoryError: PermGen size after a couple of reloads. Now I know that I can just stop/start the whole Tomcat instance, but I'm trying to track down the cause of the memory leak.</p>
  
  <p>I've read this article <a href="http://java.dzone.com/articles/memory-leak-protection-tomcat" rel="nofollow">http://java.dzone.com/articles/memory-leak-protection-tomcat</a> which indicates that I must make sure that after stopping my application there should be no outstanding references to the WebappClassLoader, which will prevent it from being garbage-collected. Using YourKit and Memory Analyzer I found several cases where that was happening in 3rd party libs and fixed them.</p>
  
  <p>I'm now at the point where both tools report that there are no 'Paths from GC roots to the object (WebappClassloader)', but still the WebappClassloader is not being garbage collected! Anyone encountered something like this before?</p>
  
  <p>I'm using Tomcat 6.0.32</p>