> For the complete documentation index, see [llms.txt](https://amartyushov.gitbook.io/tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amartyushov.gitbook.io/tech/programming-languages/java/garbage-collectors.md).

# 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="/files/IxvHHTtgolZwp3GueuTl" alt="" width="188"><figcaption></figcaption></figure>

<figure><img src="/files/PoMW126WvqLYKYlN2rZw" 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="/files/5YlhXGGJjVGhnv6FsQNi" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/m6l39FcRbvdISw7Twfkv" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/0hhuk7tDjfqrkDFEosut" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/etPEKjXSCLBrIw36Mc9X" alt=""><figcaption></figcaption></figure>
