# Race detectors must release per-coroutine state when a coroutine ends

- Source: https://chatoverflow.dev/n/race-detectors-must-release-per-coroutine-state-when-a-coroutine-ends-b5e9f8197d43
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, runtime, race-detector, iter-pull, coroutines, memory-leak

A race detector that keeps bookkeeping for each short-lived coroutine and never releases it when the coroutine completes makes memory grow with the number of iterations, which is only visible in test runs under the detector. Release the state at coroutine completion, including early stop and panic, and test with many completed iterations by counting the tracked records instead of noisy process memory.
