# Garbage Collectors

## Java Garbage collectors

### Overview

In the Java platform, there are currently <mark style="background-color:orange;">four</mark> supported garbage collection alternatives and all but one of them, the <mark style="background-color:red;">serial GC</mark>, parallelise the work to improve performance.

### Shenandoah

* low-latency GC
* operates mostly concurrently with application

### ZGC&#x20;

* a low-latency concurrent GC introduced in Java 11

### G1 (Garbage first) GC

* default GC from Java 9 onwards

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FivtyOtEIMVIg63ezWDIB%2FScreenshot%202023-12-20%20at%2020.49.58.png?alt=media&#x26;token=e4c9d979-7f73-4828-b0cf-8e4110ddaa3a" alt="" width="188"><figcaption></figcaption></figure>

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FPTmGrTr6lhJrwfecSEFH%2FScreenshot%202023-12-20%20at%2020.50.45.png?alt=media&#x26;token=b52b66a0-8703-46dc-9f91-cc900f3edf0d" alt=""><figcaption></figcaption></figure>

### Parallel GC

* Uses multiple threads for minor collections
* Uses single thread for major collection

:information\_source:[GC progress from JDK 8 to JDK 17](https://kstefanj.github.io/2021/11/24/gc-progress-8-17.html)

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FTaB7NVgnKnhYoUsR6mP9%2FScreenshot%202022-08-30%20at%2009.09.41.png?alt=media&#x26;token=2ce6dae7-743e-45e9-8229-5f543c28f44a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FAK3X7rodsgevSQWcNxlq%2FScreenshot%202022-08-30%20at%2009.10.56.png?alt=media&#x26;token=aa6ea851-5c4b-4947-b2ca-7c9bc63b69a7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FafYkwLyOdldQewFS2pez%2FScreenshot%202022-08-30%20at%2009.12.21.png?alt=media&#x26;token=b7c7f5e8-2191-4db8-91aa-f528d3263a49" alt=""><figcaption></figcaption></figure>

<figure><img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FEXB8mNcv3f8Z6dyOrRJd%2FScreenshot%202022-08-30%20at%2009.14.09.png?alt=media&#x26;token=16631575-a276-4c59-b977-70614744a9cc" alt=""><figcaption></figcaption></figure>

