Java Garbage Collection Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Java Garbage Collection =Metaspace= {{External|https://dzone.com/articles/java-8-permgen-metaspace}}")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[Java Garbage Collection#Garbage_Collection_Concepts|Java Garbage Collection]]
* [[Java Memory#Garbage_Collection_Concepts|Java Memory]]
 
=Permanent Generation=


=Metaspace=
=Metaspace=


{{External|https://dzone.com/articles/java-8-permgen-metaspace}}
{{External|https://dzone.com/articles/java-8-permgen-metaspace}}
==Overview==
The ''metaspace'' has been introduced by Java 8 to replace [[#Permanent_Generation|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 <tt>MaxMetaspaceSize</tt>. If the flag is not specified, the metaspace will resize.
Increase the initial size of the metaspace:
<pre>
-XX:MetaspaceSize=100M
</pre>
Increase the boot class loader metaspace:
<pre>
-XX:InitialBootClassLoaderMetaspaceSize=32M
</pre>
Growth parameters:
<pre>
-XX:MinMetaspaceFreeRatio=50
-XX:MaxMetaspaceFreeRatio=80
-XX:MinMetaspaceExpansion=4M
-XX:MaxMetaspaceExpansion=16M
</pre>
==Garbage Collection==
Garbage collection of the dead classes and classloaders is triggered once the class metadata usage reaches the “MaxMetaspaceSize”.
==Monitoring==
<font color=red>It is considered part of the heap?</font>

Latest revision as of 02:11, 22 April 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

Growth parameters:

-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?