Memory leak at org.hibernate.internal.SessionFactoryImpl?
Description
Attachments
Activity

Guillaume Smet August 8, 2018 at 12:53 PM
We made some significant improvements about the memory usage of SessionFactoryImpl
in the latest 5.2 and more in 5.3.
Keep in mind that this object is the central object containing all the metadata information and everything that's needed by ORM so it's normal it's a big one if you have a significant model.
Unfortunately, in all the reports, there's no useful information as we just have the overall memory usage of the session factory, which, depending on the model, might not be an issue.
I'm going to close this one. If you have issues with our latest versions and can give us details about what is contained in the SF and why it takes too much memory, then, we'll be able to revisit it.
But having a 8 MB session factory or even a 100 MB session factory might not be something abnormal depending on the size of your model. So we would definitely need far more details to be able to do something about it.
Ranjith Kumar Gampa August 8, 2018 at 3:59 AM
Same issue with 5.1.2. Heap consumed by org.hibernate.internal.SessionFactoryImpl.
Anyone found a workaround for the problem till the bug is fixed ?

Aftab January 5, 2017 at 1:51 PM
Same issue here -
Hibernate 5.1.0.Final
Spring 4.2.5
Tomcat - 8

Raph December 14, 2016 at 4:14 PM
I have the same issue.
Hibernate 5.0.7.Final
Spring 4.2.4.RELEASE
One instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.jboss.modules.ModuleClassLoader @ 0x795fe9160" occupies 100 239 320 (13,68%) bytes. The memory is accumulated in one instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.jboss.modules.ModuleClassLoader @ 0x795fe9160".
Keywords
org.hibernate.internal.SessionFactoryImpl
org.jboss.modules.ModuleClassLoader @ 0x795fe9160

RajasekharG December 7, 2016 at 10:47 PM
Same Problem.
Hibernate 4.3.8
Hibernate Jpa 2.1
Spring 4.1.7
Spring Data Jpa 1.8.2
One instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.jboss.modules.ModuleClassLoader @ 0x61362be90" occupies 69,358,280 (23.18%) bytes. The memory is accumulated in one instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.jboss.modules.ModuleClassLoader @ 0x61362be90".
Details
Details
Assignee
Reporter

One instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.apache.catalina.loader.WebappClassLoader @ 0x7832c76c0" occupies 8,109,256 (15.25%) bytes. The memory is accumulated in one instance of "org.hibernate.internal.SessionFactoryImpl" loaded by "org.apache.catalina.loader.WebappClassLoader @ 0x7832c76c0".
Keywords
org.hibernate.internal.SessionFactoryImpl
org.apache.catalina.loader.WebappClassLoader @ 0x7832c76c0
Class Name
Shallow Heap
Retained Heap
org.hibernate.internal.SessionFactoryImpl @ 0x7839de890
136 8,109,256
\factory org.hibernate.type.TypeFactory$TypeScopeImpl @ 0x7839de880
16 16
.\typeScope org.hibernate.type.ComponentType @ 0x783d8c760
56 616
..\hibernateType org.hibernate.jpa.internal.metamodel.EmbeddableTypeImpl @ 0x783d8c3f8
48 1,216
...\attributeType org.hibernate.jpa.internal.metamodel.SingularAttributeImpl$Identifier @ 0x783d8c338
40 40
....\id class org.jpp.domain.security.ProjectPermission_ @ 0x784134cf8
8 8
.....[3985] java.lang.Object[10240] @ 0x784ecd118
40,976 1,087,264
......\elementData java.util.Vector @ 0x7832e2680
32 1,087,296
.......\classes org.apache.catalina.loader.WebappClassLoader @ 0x7832c76c0
184 1,454,824
........+<classloader> class com.mysql.jdbc.AbandonedConnectionCleanupThread @ 0x783bbda40
8 8