How can a memory leak occur in a garbage-collected language like Go?

Last updated 20 June 2026

  • GC only frees unreachable memory, so leaks happen when objects stay reachable too long: ever-growing maps/caches, globals, or small slices pinning large backing arrays.

  • Goroutine leaks are common: a goroutine blocked forever on a channel or an uncancelled context keeps itself and its references alive. Unstopped time.Tickers and unremoved callbacks leak too.

  • Detect leaks by monitoring heap with pprof and watching goroutine counts over time.

  • https://www.reddit.com/r/rust/comments/1h15md8/goodbye_rust_i_wish_you_success_but_im_back_to_c/
  • https://www.reddit.com/r/golang/comments/1gfjnzm/since_when_is_senior_golang_developer_expected_to/
All Golang interview questions