title: How to limit total memory consumed by Java 8 application?
body: <p>In order to limit total memory consumed by Java 7 application I could use the following formula (taken from <a href="https://plumbr.eu/blog/why-does-my-java-process-consume-more-memory-than-xmx" rel="noreferrer">this article</a>):</p>
  
  <blockquote>
    <p>Max memory = [-Xmx] + [-XX:MaxPermSize] + number_of_threads * [-Xss]</p>
  </blockquote>
  
  <p>How this formula changes for Java 8 application, after PermGen has been removed?</p>
  
  <p>Should I use option "-XX:MaxMetaspaceSize" to limit the maximum memory consumed by metaspace instead?</p>