What is a 'goroutine leak' and how can you prevent it?

Last updated 20 June 2026

  • A goroutine leak is a goroutine that never terminates because it blocks forever (on a channel, lock, or select). Its stack and resources are never reclaimed, so memory grows under load.

  • Typical cause: sending to a channel nobody receives from (or receiving from one nobody sends to), often after the caller returned early.

  • Prevent it by giving every blocking goroutine an exit: select on ctx.Done(), guarantee receivers or close channels, and detect leaks with goleak or runtime.NumGoroutine().

  • https://salestalentinc.com/software-development-recruiters/
  • https://bencheung.me/intern-newgrad-guide
  • https://www.jobfluent.com/feeds/jobs-london.xml
  • https://www.reddit.com/r/leetcode/comments/1e3ca3q/microsoft_senior_swe_interview_experience_with/
  • https://www.lockedinai.com/company-details/HPQ
All Golang interview questions