tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <delbd+jaka...@oma.be>
Subject Re: permgen w hibernate and webapp reload
Date Fri, 01 Jun 2007 13:42:30 GMT
Hi,
The permgen problem with hibernate was due to a bug in CGLIB, used by
hibernate, which prevented classloaders from being garbage collected and
as such, the permgen memory used allocated during classloading could not
be freed at unload of webapp. This is supposed to be fixed since quite a
good amount of time. Unless you use a very old hibernate version, this
shouldn't be a problem. There are quite regulary bug reports about
memory leaks in hibernate on hibernate tracker, but most are irrelevant,
or fixed in more recent version.

When the webappclassloader does not get garbage collected, it's the
fault of the classes loaded by this classloader. One very common case i
saw is the use of ThreadLocal. ThreadLocal, behind the scene, attaches
the local value to the Thread Object. The locale value references it's
class, which reference it's classloader. The Classloader, even when not
referenced anymore by tomcat, does still get indirectly references by
the HttpThreadPool, preventing garbage collection. Another common way is
to link your object, referencing indirectly your webappclassloader, to
the JNDI and not removing it during unload.

En l'instant précis du 01/06/07 15:09, Torgeir Veimo s'exprimait en ces
termes:
> I seen the problem with permgen errors when one is redeploying a
> webapp that uses hibernate described in a number of places, but I
> haven't seen any solution for it. The Tomcat FAQ even suggest that
> this is a problem with WebAppClassLoaders,
> http://tomcat.apache.org/faq/memory.html#why .
>
> This is an extremely annoying bug,  so I'm wondering, is this
> impossible to fix? Why does tomcat exhibit this problem when Jetty
> does not?
>
>
>
> --Torgeir Veimo
> torgeir@pobox.com
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message