I'm running my project on JBoss 4.2. Hibernate is used outside project ear (for some reason I don't know). I've been investigating classloader memory leaks (as described in article
http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java) - the problem is that project classes are not garbage collected after undeployment.
I've found that EnumType Hibernate class has a static field:
private static Map<Class, Object[]> enumValues
which holds references to my enum types, which all have reference to the classloader of most of my classes. As Hibernate is outside ear, EnumType class is not garbage collected after project undeployment and because of that static field all my classes are not garbage collected as well, which is a memory leak.
Is that a bug in that class ? Should that Map hold weak references or sth ?
Any ideas how I can deal with that problem ?