How to set the minimum Metaspace in Java 8
25,197
To set the meta space to 100M, use -XX:MetaspaceSize=100M
.
https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent
Author by
Felix
Updated on July 09, 2022Comments
-
Felix almost 2 years
I have the problem, that the default Metaspace size is too small.
Right after the startup of my (Tomcat and Spring based) web application, there is a major collection, because the Metaspace is exhausted. Before Java 8, I could set the initial PermGen size with
-XX:PermSize
. Now, I'm searching for a Java 8 equivalent for that, but I had no luck so far. I'm using the G1 garbage collector. -
Nicolasllk over 3 yearsEven though this setting solved the issue, there is a slight misconception, let me clarify that. MetaspaceSize does not increase the Metaspace size, what it does is "telling" the JVM the Metaspace size threshold after which a full GC is triggered.