Question

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?

enter image description here

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.

Was it helpful?

Solution 2

I'v found solution. It turns up that connection pool c3p0 0.9.2.1 has memory leak. And hibernate 4.3.1-Final uses that version of c3p0. Switching to hibernate 4.1.12 and c3p0 0.9.1 solve my problem.

OTHER TIPS

You can try adding these Java options:

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

This enables garbage collection in PermGen space (off by default) and allows the GC to unload classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top