Start learning Go. I can not understand why memory consumption is growing. Doesn't garbage collector work? The gorutines are executed and completed.
package main import ( "time" ) const kol = 5 func parsePage(c chan <-string, page string) { time.Sleep(100 * time.Millisecond) c <- "Fin" } func main() { c := make(chan string, kol) i := 0 for { for i := 0; i < kol; i++ { go parsePage(c, "exa") } for i := 0; i < kol; i++ { //fmt.Println(i, " ", <-c) <-c } i++ time.Sleep(2000 * time.Millisecond) } }
expvarenabled,expvarmemory grows only until the garbage collectionexpvar, after which it decreases and starts growing again, as expected. - Ainar-GGOGC=10, for example, or less. See how garbage collection works. And in general, the task manager is also a tool for assembling such information. Use the sameexpvar. - Ainar-G 5:02 pm