After several redeploys app crashes with PermGen error. I know abou workarounds with increasing permgen size. But I try to reveal cause of leak. After redeploy I'v made heap dump with jvisualvm and searching for instances of WebAppClassLoader. As expected there was one not GC-ed. Show nearest GC root points to platformMBeanServer (MangementFactory type). So the question is what can i do with it?
And some additional info. My jdbc driver jar locates in lib directory of tomcat and .dll file in bin directory. When I comment hibernate sessionFactory creation - problem disappear. Session factory created in init method of servlet filter, and closed in destroy method. Hibernate uses c3p0 connection pool.