Dev Tools · 1h ago
Unbounded Channel Costs 188 MB Heap When Consumer Lags
A developer benchmarked System.Threading.Channels in .NET 10, finding that an unbounded channel with a fast producer and slow consumer caused heap memory to spike from 9 MB to 188 MB. The producer finished in 0.56 seconds, but the consumer took 2.57 seconds, leaving 90,769 items queued at peak. The unbounded channel's convenience hides significant memory cost under backpressure.
Meridian48 take
The benchmark is a useful reminder that unbounded channels are not free, but the 188 MB figure is an extreme case; most real-world workloads won't see such imbalance.
dotnetchannels