[hibernate-dev] Static meta-model and references to SessionFactoryImpl

Gunnar Morling gunnar.morling at googlemail.com
Tue Jul 19 09:45:25 EDT 2011


Hi,

while analyzing a memory leak I noticed that instances of the static
JPA 2 meta model seem to hold references to Hibernate's session
factory. In my case the path to the factory is the following:

SingularAttributeImpl#attributeType ->
EmbeddableTypeImpl#hibernateType -> ComponentType#typeScope ->
TypeScopeImpl#factory

Since the members of the meta model are static I think that means that
the factory won't be GC'ed although it was closed by the application,
hence consuming memory otherwise not needed anymore. WDYT, is this an
issue that should be addressed? Or are the meta model instances
removed at some point of time? I don't know really much about
Hibernate Core, so I hope my questions are not completely clueless ;-)

Thanks,

--Gunnar



More information about the hibernate-dev mailing list