Lolpro Lab
ArticlesCategories
Environment & Energy

Green Tea: Go's New Experimental Garbage Collector Explained

Published 2026-05-03 17:06:55 · Environment & Energy

Go 1.25 introduces an exciting experimental garbage collector called Green Tea, accessible by setting GOEXPERIMENT=greenteagc during compilation. Early benchmarks show that many applications spend about 10% less time in the garbage collector, with some workloads enjoying reductions of up to 40%. Although still experimental, Green Tea is considered production-ready and is already deployed at Google. The Go team plans to make it the default in Go 1.26, pending community feedback. This Q&A covers everything you need to know about Green Tea, from enabling it to understanding its impact.

What is the Green Tea garbage collector?

Green Tea is a new experimental garbage collector (GC) introduced in Go 1.25. It builds on Go’s existing concurrent, tracing GC but introduces optimizations that reduce the time the GC spends marking and sweeping. The collector uses a novel approach to manage heap objects and pointers more efficiently, leading to lower pause times and less CPU overhead. Despite being experimental, it has been thoroughly tested at Google on a variety of production workloads, showing consistent improvements. The name “Green Tea” reflects its goal of being more environmentally friendly by consuming fewer resources.

Green Tea: Go's New Experimental Garbage Collector Explained
Source: blog.golang.org

How does Green Tea improve performance?

Green Tea reduces the total CPU time consumed by garbage collection by 10% to 40% in many workloads. It achieves this through smarter handling of heap objects and pointer structures. For example, it uses better heuristics to decide when to start collection, and it optimizes the marking phase to reduce work. On average, applications see around 10% less GC time, but memory- or allocation-heavy programs can see up to 40% reduction. This translates to lower latency and higher throughput, especially for services with many concurrent goroutines.

How do I enable Green Tea in my Go project?

To try Green Tea, set the environment variable GOEXPERIMENT=greenteagc when building your Go application. For example, run GOEXPERIMENT=greenteagc go build in your terminal. This instructs the Go compiler and runtime to use the experimental collector. It works with any Go 1.25 toolchain. No source code changes are required. After building, test your application thoroughly, as performance varies. The Go team encourages users to report both issues and successes to help finalize the feature.

Is Green Tea production-ready?

Yes, Green Tea is considered production-ready and is already in use at Google. It has undergone extensive testing across diverse workloads, ensuring stability and correctness. However, because it is experimental in Go 1.25, it is not enabled by default. The team recommends that users try it in staging environments first, then gradually roll out to production. Some workloads may not benefit significantly or may even see regression; the team welcomes issue reports and success stories to improve the collector.

Green Tea: Go's New Experimental Garbage Collector Explained
Source: blog.golang.org

Will Green Tea become the default in Go 1.26?

Based on current data, the Go team plans to make Green Tea the default garbage collector in Go 1.26, scheduled for release in 2026. This decision depends on feedback from the community. If no major regressions surface and performance improvements hold across a wide range of applications, it will replace the existing GC. Users who prefer the older behavior will be able to opt out via a build experiment. The team is actively monitoring reports to ensure a smooth transition.

How does Go's garbage collector work?

Go uses a concurrent, tracing garbage collector. It identifies objects that are no longer reachable from the program's root pointers (e.g., stack variables, global references). The collector marks live objects during a “stop-the-world” pause (though it’s concurrent for most work) and then sweeps freed memory. Objects are heap-allocated values that the compiler cannot allocate elsewhere. Pointers connect objects in a graph. The GC traverses this graph to find reachable objects. Green Tea improves this process by optimizing the tracing algorithm and reducing overhead, especially for large heaps or pointer-heavy structures.

What should I do if I find issues or successes?

If you encounter problems while using Green Tea, please file a new issue on the Go issue tracker. Include details about your workload, hardware, and any error messages. For positive experiences, reply to the existing Green Tea issue with performance data and context. Your feedback directly influences the development and helps decide whether Green Tea becomes the default. The Go team is particularly interested in comparative benchmarks between the default GC and Green Tea.