-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: -race allocates 2.8x VM in Go 1.4 vs Go 1.3.3 #9332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The high memory usage is not a side effect of converting the race runtime high VM usage is generally not a problem, and RSS doesn't increase much. |
Fair enough; it's not that commit. More details: Linux amd64, ~6GB RAM, 1GB swap. At some point high VM does seem to become a problem. We were seeing failures depending on how As a dramatic example, a worker pool of 8000 goroutines has no hope of working in Go 1.4 with Bottom line is this behavior seems to have changed between 1.3 and 1.4. It's not blocking us anymore but wanted to at least log the issue so others can find it. We can spend more time on whittling it down to a reproducible example, but it seems like something that applies across-the-board (-race + N goroutines). |
Small reproduction: package main
import (
"fmt"
"os"
"os/exec"
"sync"
"time"
)
func main() {
wg := new(sync.WaitGroup)
wg.Add(8000)
for i := 0; i < 8000; i++ {
go func() { wg.Done(); time.Sleep(10 * time.Hour) }()
}
wg.Wait()
cmd := exec.Command("ps", "auxf")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
fmt.Println(cmd.Run())
} On 1.4:
On 1.3.3:
(Also note the time taken to run. Way different.) |
According to The change could be due to updates to the race detector core during the 1.4 |
@dvyukov, any ideas what might have changed wrt VM usage? |
Tested locally. I don't have 1.3, so taking the reported report: So, on tip memory consumption dropped 2x as compared to 1.3. |
We upgraded to 1.4 recently and noticed dramatically higher memory usage when using the -race flag.
The following table is the memory usage expressed in virtual and resident (as seen in htop), with and without -race:
2236M
/36352
418M
/8576
782M
/24884
427M
/8884
Is this a side-effect of converting them automatically from C to Go? (as seen in 59e3e53).
We noticed this because tests started running out of memory and failing. Looks like the overall footprint is just much higher with
-race
than in 1.3.3 (which was also higher, but not as bad)./cc @onsi @krishicks
The text was updated successfully, but these errors were encountered: