title: java.lang.OutOfMemoryError: Metaspace error after migrating to Java 8 from Java 7
body: <p>We got OutOfMemoryError when upgraded. The JVM settings are kept same as Java 7 which was working fine.</p>
  
  <p>Here is the settings in Jboss 4.2 server:</p>
  
  <blockquote>
    <p>-server -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Xms4096m -Xmx7168m -XX:MaxMetaspaceSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Djava.security.egd=file:///dev/urandom</p>
  </blockquote>
  
  <p>Only difference in Java 7 is XX:MaxMetaspaceSize=512m was replace with PermGen max.</p>
  
  <p>I wonder why it needs more Metaspace for class loading since the server &amp; application is same &amp; only change in Java version.</p>