[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4317?page=c...
]
Ondrej Medek commented on HHH-4317:
-----------------------------------
Pablo, that workaround has worked for me. I have not added whole hibernate-annotation.jar,
just the EnumType class. I have tried it with just one simple application, though.
My simple testing with JRE 6 has shown, that HashMap.get() (for a small HashMap, just 4
entries) is approx. 100-times faster then calling a static method by reflection (which is
used to get the values of enum). Anyway, calling Class.forName (which is in the
EnumType.setParameterValues()) method is approx. as fast as calling a static method by
reflection.
So, if the question is whether to cache or not to cache, I think it should be cached
either both enumClass and enumValues, or nothing.
I am attaching an EnumType without caching. Regarding this (quick) patch: it does early
init of enumClass and lazy init of enumValues. I am not sure if it is right or not.
Memory leak in EnumType class.
------------------------------
Key: HHH-4317
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4317
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Reporter: Paweł Kępka
Priority: Critical
Attachments: enumtypeleak.war
Holding enum values in static enumValues map in EnumType class causes memory leaks on
application server where hibernate is loaded by application server's common
classloader (like for default configuration of JBoss4).
SoftReference or SessionFactory based caching should be used instead.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira