Join GitHub today
runtime: make runtime.GC, debug.FreeOSMemory concurrent #18216
We've seen servers get utterly wedged because code incorrectly calls runtime.GC or debug.FreeOSMemory. Especially if multiple goroutines all decide this is necessary at the same time and stack up.
The implementations should both (1) use a concurrent GC, blocking of course until the GC is done, and (2) unblock all calls that arrived _before the GC started, so that if you call runtime.GC from 100 goroutines all at once, then you get something like two GCs (whatever starts first, and then the other 99 or so show up during the first GC, which kicks off one more).