Up to 40 percent less overhead: Go 1.25 with new garbage collector
The new, experimental garbage collector should significantly reduce the overhead. There are also further updates for tools, libraries, runtime and compilers.
(Image: Dotted Yeti/Shutterstock.com)
Six months after Go 1.24, version 1.25 of the programming language has been released. Most of the changes concern the toolchain, runtime, and libraries, and an experimental new garbage collector is also included. Almost all Go programs should be compilable and executable with the new version as before.
Experimental garbage collector
The new “Green Tea” garbage collector is available as an experimental feature. Its design is intended to improve performance when marking and scanning small objects. The Go team expects a reduction in garbage collection overhead of between 10 and 40 percent in real projects with heavy use of the garbage collector.
Videos by heise
The experimental garbage collector can be activated at build time with GOEXPERIMENT=greenteagc. The corresponding GitHub issue provides further information.
Tool updates
There are some new features for the go command. For example, the go build -asan option now executes leak detection by default when the program is closed, which can lead to error messages relating to unreleased memory. The Go distribution contains fewer pre-built tool binaries in the new release; it continues to provide core toolchain binaries such as compilers and linkers but go tool creates others on demand.
In addition, the go vet command includes two new analyzers: waitgroup to report misplaced calls to sync.WaitGroup.Add and hostport, which reports uses of fmt.Sprintf("%s:%d", host, port) to create addresses for net.Dial – because these do not work with IPv6. Instead, the new analyzer suggests using net.JoinHostPort.
Other new features concern the standard library and the compiler. In the latter, the Go team has fixed a bug in nil pointer checks that was inadvertently introduced in Go 1.21. For example, Go would have previously executed the following code, but this is incorrect. Now a panic with nil-pointer exception occurs correctly.
package main
import "os"
func main() {
f, err := os.Open("nonExistentFile")
name := f.Name()
if err != nil {
return
}
println(name)
}
Further details on these and other new features in Go 1.25 can be found in the Go blog and the release notes. The new language version is available on the download page.
(mai)