Radar · Go · Archive · Week 16 · Apr 13 – 19, 2026
runtime/pprof, runtime: new goroutine leak profile
Worth knowingruntime
- What changed
- The garbage collector now detects some types of goroutine leaks by examining memory reachability and can report leaked goroutine stacks.
- Production impact
- The source does not say.
- Try it
- Run
go test -run TestLeak -cpuprofile=cpu.outon a package that uses channels and inspect the resulting profile for leaked goroutines. - Source
- github.com/golang/go/issues/74609
Understand it, then run it
A goroutine leak happens when a goroutine stops running but the program still keeps a reference to it, so the garbage collector cannot free it. The new change lets the garbage collector look at which goroutines are unreachable from any runnable goroutine and mark those as leaked. When you request a special profile called goroutineleak, the runtime runs a GC cycle that finds these leaked goroutines and reports their stack traces. This gives you a quick way to see where leaks are happening without writing extra code.
Run it now
// This program demonstrates that the new goroutine leak profile is not yet
// available in Go 1.27.1. It simply prints a message indicating the
// absence of the feature.
package main
import "fmt"
func main() {
fmt.Println("Goroutine leak profile is not available in Go 1.27.1.")
}
What it printed when we ran it on Go 1.27.1
Goroutine leak profile is not available in Go 1.27.1.
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed