title: Possible Memory Leak due to org.hibernate.internal.SessionFactoryImpl
body: <p>I have made and MVC webapp in Java, but when I run it, once a day, it turns down again due to a memory error.</p>
  
  <p>This error is this:
  Exception in thread "http-apr-12136-exec-42" java.lang.OutOfMemoryError: Java heap space</p>
  
  <p>java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space</p>
  
  <p>I have the hprof with the stats of the crash, where specific how is the memory used. If I open the hprof with the Eclipse Memory Analizer, I have this results:</p>
  
  <p>In rar: <a href="https://mega.co.nz/#!Ht41xJDJ!MooePBSv5yOYSNN5OuvF7Afn2rcN-KJ2tXGSsgqtsaI" rel="noreferrer">https://mega.co.nz/#!Ht41xJDJ!MooePBSv5yOYSNN5OuvF7Afn2rcN-KJ2tXGSsgqtsaI</a></p>
  
  <p>Or in a folder: <a href="https://mega.co.nz/#F!6hJUyKbQ!D_Kb23E3KfAJqcd5EeAt0A" rel="noreferrer">https://mega.co.nz/#F!6hJUyKbQ!D_Kb23E3KfAJqcd5EeAt0A</a></p>
  
  <p>In the Overview report, I have this graphic (OverviewEMA.JPG):
  I don't know what this graphic say... I don't understand it.</p>
  
  <p>In the second tab, the default report, I have this graphic (DefaulReport_EMA.JPG):
  It say the problem can be one instance of "org.hibernate.internal.SessionFactoryImpl". But I don't know how to solve that instance.</p>
  
  <p>In the next tabs. In the dominator tree, again appears the previous instance, which use around 42MB of memory (the same that show the first graphic). The image is DominatorTree_EMA.JPG</p>
  
  <p>If I expand the first class (the class that gives problems), I have this graphic (DominatorTreeExpanded_EMA.JPG):</p>
  
  <p>In the next tab, in the histogram, the graphic is this (Histogram_EMA.JPG):</p>
  
  <p>And in the Unreachable objects, the result is this (UnreachableObjects_EMA.JPG):</p>
  
  <p>I don't understand very well this 2 last graphics</p>
  
  <p>At last, I also have the report of Java VisualVM, where I have this results (Heapdump_JVM.JPG):</p>
  
  <p>According to this graphic, the HashMap objects are the problem, besides Integer and String objects. The Hashmap objects I think are the objects of the model that the classes send to jsp files, and it proceed from the JPA Objects (the objects of Hibernate), so the problem could be this, but I don't know how to solve it...</p>
  
  <p>Could someone help me? Someone know how can I fix it? Do you need some information more?</p>
  
  <p>Thanks!</p>