mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: use mcache0 if no P in profilealloc
A case that I missed in CL 205239: profilealloc can be called at program startup if GOMAXPROCS is large enough. Fixes #38474 Change-Id: I2f089fc6ec00c376680e1c0b8a2557b62789dd7f Reviewed-on: https://go-review.googlesource.com/c/go/+/228420 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
415da71c5d
commit
7ea40f6594
2 changed files with 23 additions and 1 deletions
|
|
@ -1037,3 +1037,16 @@ loop:
|
|||
t.Errorf("netpollBreak did not interrupt netpoll: slept for: %v", dur)
|
||||
}
|
||||
}
|
||||
|
||||
// TestBigGOMAXPROCS tests that setting GOMAXPROCS to a large value
|
||||
// doesn't cause a crash at startup. See issue 38474.
|
||||
func TestBigGOMAXPROCS(t *testing.T) {
|
||||
t.Parallel()
|
||||
output := runTestProg(t, "testprog", "NonexistentTest", "GOMAXPROCS=1024")
|
||||
if strings.Contains(output, "failed to create new OS thread") {
|
||||
t.Skipf("failed to create 1024 threads")
|
||||
}
|
||||
if !strings.Contains(output, "unknown function: NonexistentTest") {
|
||||
t.Errorf("output:\n%s\nwanted:\nunknown function: NonexistentTest", output)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue