Two concurrency patterns which avoid goroutine leaks
Go has automatic memory management, but it's still possible to leak memory. Probably the most common kind of leak I've seen is leaking goroutines. You start a goroutine to do some work, but forget to arrange for the goroutine to stop. The goroutine holds on to memory and the garbage collector can't clean it up. This post covers two examples from the Go standard library for doing work in goroutines such that the goroutines don't leak. The examples embody Dave Cheney's advice: "never start a goroutine without knowing how it will stop."