---
title: "Goroutine Leak Profiles"
description: "Go 1.27 adds a goroutineleak profile that finds goroutines permanently blocked on channels or sync primitives (Mutex, RWMutex, WaitGroup, Cond) in running programs, including production, with few or no false positives."
url: "https://swe.quest/articles/goroutine-leak-profiles-28367c8af5986ce1"
canonical: "https://go.dev/blog/goroutine-leak-profiles"
source: "The Go Blog"
published: "2026-09-02"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 23
tags: ["go","concurrency","memory-management","debugging","runtimes"]
---

# Goroutine Leak Profiles

A post on [The Go Blog](https://swe.quest/sources/go.md), published 2026-09-02, 23 min read, Deep dive. Original: [https://go.dev/blog/goroutine-leak-profiles](https://go.dev/blog/goroutine-leak-profiles)

## Summary

Go 1.27 adds a goroutineleak profile that finds goroutines permanently blocked on channels or sync primitives (Mutex, RWMutex, WaitGroup, Cond) in running programs, including production, with few or no false positives. It works by modifying the garbage collector's mark phase. Only unblocked goroutines start as roots, and blocked goroutines are added iteratively when a primitive blocking them is reachable from a live goroutine. Any goroutine never reached is reported as leaked. The profile is exposed via runtime/pprof and /debug/pprof/goroutineleak and is demonstrated on an unbuffered-channel early-return leak. Limitations: it cannot see IO or syscall blocking, it misses leaks where a primitive stays reachable through globals, and pathological "daisy-chain" cases serialize marking with O(n²) inspection. Periodic, infrequent profiling is the recommended way to keep overhead low.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Go](https://swe.quest/tags/go.md) (Languages)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)
- [Memory management](https://swe.quest/tags/memory-management.md) (Compilers & runtimes)
- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)

## Prerequisites

- Go goroutines and channels ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- sync package primitives
- pprof profiling ([easy posts on Performance engineering](https://swe.quest/tags/performance.md?difficulty=easy))
- mark-and-sweep garbage collection ([easy posts on Memory management](https://swe.quest/tags/memory-management.md?difficulty=easy))

## Keywords

Go 1.27, pprof, goroutineleak, goleak, synctest, Green Tea GC, ASPLOS 2025

## Related posts

- [Profiling improvements in Go 1.18](https://swe.quest/articles/profiling-improvements-in-go-1-18-696a3ae4a6369181.md): Datadog Engineering · 2022-02-28 · Hard · 8 min read · Go, Performance engineering, Runtimes & VMs, Linux, Observability
  Go 1.18's Linux CPU profiler no longer underestimates CPU bursts on multi-core systems.
- [Go Turns 17](https://swe.quest/articles/go-turns-17-44df44064c6960cc.md): The Go Blog · 2026-11-10 · Easy · 12 min read · Go, Performance engineering, Developer tools, Cryptography, Memory management
  Go's 17th anniversary recap covers Go 1.26 and 1.27. On the language side, it adds generic methods, self-referential constraints, \`new\` with an initial value, and nested struct literal keys.
- [Adding the V8 CPU Profiler to v8go](https://swe.quest/articles/adding-the-v8-cpu-profiler-to-v8go-57f5c1c58134c15f.md): Shopify Engineering · 2022-03-04 · Medium · 10 min read · Go, Performance engineering, API design, Runtimes & VMs, JavaScript
  Exposing V8's CPU profiler through v8go, the Go library for running JavaScript in V8 isolates via Cgo, came down to a choice between lazily fetching each profile node property with its own Cgo call or eagerly building the whole call tree in C++ and rebuilding it in Go from a single pointer.
- [Debugging JavaScript Memory Leaks](https://swe.quest/articles/debugging-javascript-memory-leaks-440c20d303c4be9c.md): Bun · 2025-04-02 · Medium · 8 min read · Memory management, Debugging, JavaScript, Runtimes & VMs
  Bun implements V8's writeHeapSnapshot API, so heap snapshots can be loaded and diffed in Chrome DevTools, where a steadily growing Delta column reveals leaks. bun:jsc's heapStats also reports per-type object counts, including objects protected from GC.
- [How we tracked down a Go 1.24 memory regression across hundreds of pods](https://swe.quest/articles/how-we-tracked-down-a-go-1-24-memory-regression-across-hundreds-of-pods-bbf00972d141a71d.md): Datadog Engineering · 2025-07-17 · Medium · 9 min read · Go, Memory management, Debugging, Performance engineering, Runtimes & VMs
  Upgrading a data-processing service to Go 1.24 raised container memory by about 20% even though Go runtime metrics and heap profiles stayed flat.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
