With Java 8 removing PermGen, we can no longer use the JVM arguments to change it or limit it.
But if I have a memory leak in my app, I want to know about it. I do not want the JVM to allocate gigabytes of memory.
So my question is: how far will it go, when will it stop, and can I limit it from the OS (using ulimit
)?
PermGen always has a fixed maximum size. Metaspace by default auto increases its size depending on the underlying OS.
The default size of -XX:MetaspaceSize is platform-dependent and ranges from 12 MB to about 20 MB. Information about the space used for metadata is included in a printout of the heap.
Metaspace is a native memory region that stores metadata for classes. As a class is loaded by the JVM, its metadata (i.e. its runtime representation in the JVM) is allocated into the Metaspace. The Metaspace occupancy grows as more and more classes are loaded.
The Metaspace takes up a significant portion of the JVM's Non-Heap memory. Its main purpose is to store class metadata — the internal runtime representation of Java classes. By default, the metaspace is comprised of two parts — the Class Space and the Non-Class Space.
Yes, by default metaspace is unlimited. Not to worry: you can still set an upper limit on the amount of metaspace available to the JVM. -XX:MaxMetaSpaceSize
to the rescue.
http://java.dzone.com/articles/java-8-permgen-metaspace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With