title: High memory usage when using Hibernate
body: <p>I code a server side application with java run on linux server.
  I use hibernate to open session to database, use native sql to query it and always close this session by try, catch, finally.</p>
  
  <p>My server query DB using hibernate with very high frequency.</p>
  
  <p>I already define MaxHeapSize for it is 3000M but it usually use 2.7GB on RAM, it can decrease but slower than increase. Sometime it grow up to 3.6GB memory usage, more than my MaxHeapSize define when start.</p>
  
  <p>When memory used is 3.6GB, i try to dump it with -jmap command and got a heapdump with size of 1.3GB only. </p>
  
  <p>Im using eclipse MAT to analyse it, here is the dominator tree from MAT
  <img src="https://i.stack.imgur.com/a4FNm.png" alt="Dominator tree">
  I think hibernate is the problem, i have so many org.apache.commons.collections.map.AbstractReferenceMap$ReferenceEntry like this. It maybe cant be dispose by garbage collection or can but slow.</p>
  
  <p>How can i fix it?</p>