Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit total memory consumed by Java 8 application?

In order to limit total memory consumed by Java 7 application I could use the following formula (taken from this article):

Max memory = [-Xmx] + [-XX:MaxPermSize] + number_of_threads * [-Xss]

How this formula changes for Java 8 application, after PermGen has been removed?

Should I use option "-XX:MaxMetaspaceSize" to limit the maximum memory consumed by metaspace instead?

like image 732
rmaruszewski Avatar asked Feb 02 '15 12:02

rmaruszewski


Video Answer


1 Answers

Yes, there is -XX:MaxMetaspaceSize instead of -XX:MaxPermSize.

Consider also -XX:MaxDirectMemorySize to limit memory for direct ByteBuffers.

like image 111
apangin Avatar answered Sep 28 '22 05:09

apangin