# Goroutine Leaks - The Forgotten Sender

DevFeed: [Goroutine Leaks - The Forgotten Sender](<https://devfeed.tech/articles/goroutine-leaks-the-forgotten-sender-22139.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2018/11/goroutine-leaks-the-forgotten-sender.html>)

Published: 2018-11-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrent-programming](<https://devfeed.tech/tags/concurrent-programming.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [goroutines](<https://devfeed.tech/tags/goroutines.md>), [memory-leak](<https://devfeed.tech/tags/memory-leak.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [performance](<https://devfeed.tech/tags/performance.md>), [programming](<https://devfeed.tech/tags/programming.md>), [review](<https://devfeed.tech/tags/review.md>)

## AI overview

This article explains how goroutine leaks occur in Go concurrent programs. It describes a leak as a goroutine that is expected to terminate but remains blocked indefinitely, keeping its allocated memory for the lifetime of the application, and illustrates how a goroutine waiting on a channel can become unreachable when its calling function returns.

## Source excerpt

Introduction Concurrent programming allows developers to solve problems using more than one path of execution and is often used in an attempt to improve performance. Concurrency doesn't mean these multiple paths are executing in parallel; it means these paths are executing out-of-order instead of sequentially. Historically, this type of programming is facilitated using libraries that are either provided by a standard library or from 3rd party developers. In Go, concurrency features like Goroutines and channels are built into the language and runtime to reduce or eliminate the need for libraries. This has created the illusion that writing concurrent programs in Go is easy. You must be cautious when deciding to use concurrency as it comes with some unique side effects or traps if not used correctly. These traps can create complexity and nasty bugs if you're not careful.