Grokking Concurrency in Go
0% completed
Goroutine Leaks
A service asks three mirrors for the same page and answers with whichever reply arrives first. Each call to fetch takes 100 ms, so every request finishes in about 100 ms. The service handles 500 requests, and every one of them returns the right page.
Before the requests, runtime.NumGoroutine reports 1 goroutine. After all 500 requests have returned, it reports 1,001. Each request left two goroutines behind. At a minimum of 2 KB of stack each, those 1,000 goroutines hold about 2 MB that will never be freed
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%