Go 1.25 Debuts Experimental Green Tea Garbage Collector: Up to 40% Less GC Overhead

From Jsmeihe, the free encyclopedia of technology

Introduction

The Go programming language is constantly evolving to improve performance and developer experience. In Go 1.25, a groundbreaking experimental garbage collector named Green Tea has been introduced, promising significant reductions in garbage collection overhead for many workloads. This article explores what Green Tea is, how it works, and what it means for Go developers.

Go 1.25 Debuts Experimental Green Tea Garbage Collector: Up to 40% Less GC Overhead
Source: blog.golang.org

Understanding Tracing Garbage Collection

Before delving into Green Tea, it's essential to understand the fundamentals of garbage collection in Go. At its core, garbage collection automatically reclaims memory that is no longer in use, preventing memory leaks and simplifying memory management.

In the Go runtime, the garbage collector focuses on objects and pointers. Objects are Go values allocated from the heap—typically when the compiler cannot determine another way to allocate memory. The collector identifies which objects are still reachable by tracing pointers from root references (such as global variables and stack frames). Any object not reached is considered garbage and its memory is freed.

This tracing mechanism is the foundation of Go's existing garbage collector. Green Tea builds upon this concept with a novel approach to reduce overhead.

Introducing the Green Tea Garbage Collector

Green Tea is an experimental garbage collector available in Go 1.25, activated by setting the environment variable GOEXPERIMENT=greenteagc at build time. It is already being used in production at Google and is considered production-ready. The name “Green Tea” reflects its goal: a cleaner, more efficient memory management process that leaves less “waste” (overhead) behind.

According to early benchmarks, many workloads see a reduction of around 10% in garbage collection time, with some workloads experiencing improvements of up to 40%. However, results vary—some applications see little or no benefit, and in rare cases, performance may even degrade. The Go team encourages developers to test Green Tea with their own applications and provide feedback.

How to Enable Green Tea

To try Green Tea in your Go 1.25 project, simply build with:

GOEXPERIMENT=greenteagc go build

No code changes are required; the collector is a drop-in replacement for the current default GC. If you encounter any issues, please file a new issue. If you see improvements, share your success on the existing Green Tea issue.

Performance Impact and Benchmarks

The performance gains come from optimizations in how Green Tea handles memory trace operations. The exact mechanics are complex, but the key improvement is a reduction in CPU cycles spent on GC-related work. In production at Google, Green Tea has proven stable and beneficial across a range of services.

Go 1.25 Debuts Experimental Green Tea Garbage Collector: Up to 40% Less GC Overhead
Source: blog.golang.org

The following table summarizes typical GC time reductions seen in early testing (data from the Go team):

Workload Type GC Time Reduction
Web servers 10–15%
Database caches 20–40%
Interactive tools 5–10%
CPU-bound batch jobs 0–5%

Note: Actual results may vary.

Roadmap and Future Plans

The Go team plans to make Green Tea the default garbage collector in Go 1.26, provided that community feedback is positive and no major issues arise. This timeline underscores the team's confidence in the collector’s maturity.

To prepare for this transition, developers are encouraged to test Green Tea with their projects now. Early adoption will help identify edge cases and ensure a smooth rollout.

Community Feedback Matters

As with any experimental feature, feedback is crucial. The Go team relies on reports from developers to refine the collector. If Green Tea works well for your application, let the team know. If it doesn’t, detailed bug reports help improve it for everyone.

Conclusion

The Green Tea garbage collector represents a significant step forward in Go’s memory management. With potential GC time reductions of up to 40% and a production‑ready status at Google, it is a compelling upgrade for many Go developers. By enabling it today with GOEXPERIMENT=greenteagc, you can help shape the future of Go.

For more details, watch Michael Knyszek’s GopherCon 2025 talk (the basis for this article) or visit the official Go blog.

References