title: PS Old Gen memory in Heap Memory Usage: GC settings for Java Out Of Memory Exception
body: <p><img src="https://i.stack.imgur.com/tezKO.png" alt="enter image description here"></p>
  
  <p>Below are my JVM settings:</p>
  
  <pre><code> JAVA_OPTS=-server -Xms2G -Xmx2G -XX:MaxPermSize=512M -Dsun.rmi.dgc.client.gcInterval=1200000 -Dsun.rmi.dgc.server.gcInterval=1200000 -XX:+UseParallelOldGC -XX:ParallelGCThreads=2 -XX:+UseCompressedOops  -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jbos88,server=y,suspend=n
  </code></pre>
  
  <p>Problem:
  Total Heap Memory: 2GB
  Old Gen: 1.4GB (2/3 of Heap)
  New Gen: 600MB(1/3 of Heap)</p>
  
  <p>The Old Gen grows in memory beyond 70% 0f its allocated size and never is subjected to GC even at 100% i.e 1.4GB.
  One can see the graph below it peaks and never is GC, the drop in memory is when it was forced to GC from the JConsole.
  This problem is eventually bringing the web server down.</p>
  
  <p>Anything that i am missing or wrongly setting the JVM?</p>
  
  <p>Thanks for the help in advance.</p>
  
  <p>Updating my Question:</p>
  
  <p>After heap analysis it appears like Stateful session bean is the prime suspect:
  <img src="https://i.stack.imgur.com/g6vLe.jpg" alt="enter image description here">
  We have stateful session beans that hold the persistence logic assisted by Hibernate.</p>