title: Tomcat 8 and Java 8: High Memory usage
body: <p><strong>Background</strong>:</p>
  
  <pre><code>Windows Server 2012 R2- 64 bit
  16 GB RAM
  Tomcat 8
  Java 8 
  </code></pre>
  
  <p>I am running a java application on Tomcat 8. I am facing high memory usage problem. The memory usage goes up to  95% and server crashes. No problem with CPU usage.</p>
  
  <p>I am setting JAVA_OPTS in <code>tomcat\bin\catalina.bat</code></p>
  
  <pre><code>set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:PermSize=512m -XX:+UseParallelGC"
  </code></pre>
  
  <p>NOTE: XMS and XMX is set from catalina UI.</p>
  
  <p><strong>I understand, there is no PermGen concept in Java 8</strong> so I tried below JAVA_OPTS with -XX:MaxMetaspaceSize=512m too </p>
  
  <pre><code>set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxMetaspaceSize=512m -XX:+UseParallelGC"
  </code></pre>
  
  <p>But no luck.</p>
  
  <p>Interesting thing:</p>
  
  <p>The memory used by tomcat process remain around 3.5 GB but memory usage goes up  to 15 GB. All the remaining processes add up to 1 GB only. I have no clue which process is consuming remaining 9-10 GB.</p>
  
  <p>The system memory goes up and here is the snap.
  <a href="https://i.stack.imgur.com/dNlzD.png" rel="nofollow"><img src="https://i.stack.imgur.com/dNlzD.png" alt="Task Manager"></a></p>
  
  <p>Any thoughts?</p>
  
  <p>Thanks.</p>