For the following code:
const LOOPNUM int = 200000
func main() {
z := make(chan int16)
for i := 0; i < LOOPNUM; i++ {
go test(z)
}
}
func test(a chan<- int16) {
a <- -1
}
I ran the code with LOOPNUM = 200k and 400k, and the memory usage is like the following:
Does anyone know the reason of the sudden memory increment after I doubled my goroutines (and any solution to reduce memory usage)?
Thanks!