# G1 becomes the JVM's default garbage collector in every environment

Original title: The G1 Garbage Collector

> Hacker News story 50527444 · language: en · submitted 2026-11-17
> Web version: https://zeli.app/story/50527444
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 114 · by [ejboy](<https://news.ycombinator.com/user?id=ejboy>) · 💬 75
[original](<https://dev.java/learn/jvm/tool/garbage-collection/g1gc-overview/>) · [HN discussion](<https://news.ycombinator.com/item?id=50527444>)

## Summary

G1, the Garbage-First collector, has been the default on server-class JVMs since JDK 9, but JDK 27's JEP 523 makes it the default everywhere, even on a single CPU with under 2 GB of memory. Originally built to replace CMS for large multi-core machines, G1 balances throughput against pause time and reclaims the regions holding the most garbage first. The article traces its history, heap layout, and collection cycle, and explains why tuning usually means trading one goal for another.

## Key quote

> This is what "Garbage-First" in the G1 name refers to: it will reclaim the regions with the most garbage first.

## HN discussion (75 comments)

### [brunoborges](<https://news.ycombinator.com/item?id=50579926>)

> Lots of details that teams miss when tuning the JVM on Kubernetes:
>
> 1. Default heap size varies: it can be 50% of the available memory for any amount of available memory up to 256mb; ~128mb for anywhere between 256 and 512; and then 25% for anything above 512mb;
>
> 2. The JVM will still do parallel threads even when CPU limit is 1,000 or below , which triggers CPU throttling much faster. Threads such as GC (even when it is SerialGC), ForkJoin pools, Database connection pools, HTTP server, and so on.
>
> 3. The JVM behaves MUCH better with 2,000 or more milicores, and a well sized heap. Having very small containers and dozens of replicas is worse than having slightly bigger containers (cpu/memory limits) and fewer replicas, even with a different ratio (e.g. 6 replicas will perform worse than 3 replicas, even when aggregated CPU and memory limits are the same).
>
> I've been advocating on this for years [1].
>
> [1] https://www.youtube.com/watch?v=wApqCjHWF8Q

### [Fizzadar](<https://news.ycombinator.com/item?id=50576755>)

> I remember switching on G1GC for Elasticsearch back in 2014 and it was a total game changer for cluster stability (ES had plenty of other warts back then to counter the improvement). Cool to see it land as the default everywhere over a decade later.

### [ahmedfromtunis](<https://news.ycombinator.com/item?id=50577451>)

> I love that they also have learn.java and inside.java.
>
> They should make get.java point to the download page. Oh and docs.java would be very cool!

### [pancakeguy](<https://news.ycombinator.com/item?id=50579840>)

> garbage collection will almost certainly be a relic of the past surprisingly soon. Fundamentally it exchanges efficiency for readability & developer experience, to things that do not matter when using AI to write code.

### [cyberax](<https://news.ycombinator.com/item?id=50579174>)

> And still no automatic heap sizing... Maybe next year?

---

## Cite

- Page: https://zeli.app/story/50527444
- Date: 2026-11-17
- Source: dev.java (https://dev.java/learn/jvm/tool/garbage-collection/g1gc-overview/)
- Hacker News: https://news.ycombinator.com/item?id=50527444

## Other languages

- zh: https://zeli.app/zh/story/50527444 · markdown: https://zeli.app/zh/story/50527444.md
- ja: https://zeli.app/ja/story/50527444 · markdown: https://zeli.app/ja/story/50527444.md
- ko: https://zeli.app/ko/story/50527444 · markdown: https://zeli.app/ko/story/50527444.md
- de: https://zeli.app/de/story/50527444 · markdown: https://zeli.app/de/story/50527444.md
- es: https://zeli.app/es/story/50527444 · markdown: https://zeli.app/es/story/50527444.md
- ru: https://zeli.app/ru/story/50527444 · markdown: https://zeli.app/ru/story/50527444.md
