Java Garbage Collection Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 21: Line 21:
Increase the initial size of the metaspace:
Increase the initial size of the metaspace:


<tt>
<pre>
-XX:MetaspaceSize=100M
-XX:MetaspaceSize=100M
</tt>
</pre>


Increase the boot class loader metaspace:
Increase the boot class loader metaspace:


<tt>
<pre>
-XX:InitialBootClassLoaderMetaspaceSize=32M
-XX:InitialBootClassLoaderMetaspaceSize=32M
</tt>
<pre>


Growth parameters:
Growth parameters:


<tt>
<pre>
-XX:MinMetaspaceFreeRatio=50
-XX:MinMetaspaceFreeRatio=50
-XX:MaxMetaspaceFreeRatio=80
-XX:MaxMetaspaceFreeRatio=80
-XX:MinMetaspaceExpansion=4M
-XX:MinMetaspaceExpansion=4M
-XX:MaxMetaspaceExpansion=16M
-XX:MaxMetaspaceExpansion=16M
</tt>
</pre>


==Garbage Collection==
==Garbage Collection==

Revision as of 07:43, 16 February 2017

Internal

Permanent Generation

Metaspace

https://dzone.com/articles/java-8-permgen-metaspace

Overview

The metaspace has been introduced by Java 8 to replace permanent generation. Most allocations for the class metadata are now allocated out of native memory.

Capacity

By default the metaspace can extend to the limit of the physical memory.

It can be limited by MaxMetaspaceSize. If the flag is not specified, the metaspace will resize.

Increase the initial size of the metaspace:

-XX:MetaspaceSize=100M

Increase the boot class loader metaspace:

-XX:InitialBootClassLoaderMetaspaceSize=32M
<pre>

Growth parameters:

<pre>
-XX:MinMetaspaceFreeRatio=50
-XX:MaxMetaspaceFreeRatio=80
-XX:MinMetaspaceExpansion=4M
-XX:MaxMetaspaceExpansion=16M

Garbage Collection

Garbage collection of the dead classes and classloaders is triggered once the class metadata usage reaches the “MaxMetaspaceSize”.

Monitoring

It is considered part of the heap?