mirror of
https://github.com/golang/go
synced 2024-11-13 18:50:24 -07:00
cmd/internal/ld, runtime: unify stack reservation in PE header and runtime
With 128KB stack reservation, on 32-bit Windows, the maximum number threads is ~9000. The original 65535-byte stack commit is causing problem on Windows XP where it makes the stack reservation to be 1MB despite the fact that the runtime specified 128KB. While we're at here, also fix the extra spacings in the unable to create more OS thread error message: println will insert a space between each argument. See #9457 for more information. Change-Id: I3a82f7d9717d3d55211b6eb1c34b00b0eaad83ed Reviewed-on: https://go-review.googlesource.com/2237 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Minux Ma <minux@golang.org>
This commit is contained in:
parent
edac5d9144
commit
da11a9dda3
@ -1225,12 +1225,13 @@ func Asmbpe() {
|
||||
// for other threads we specify stack size in runtime explicitly
|
||||
// (runtime knows whether cgo is enabled or not).
|
||||
// If you change stack reserve sizes here,
|
||||
// change STACKSIZE in runtime/cgo/gcc_windows_{386,amd64}.c as well.
|
||||
// change STACKSIZE in runtime/cgo/gcc_windows_{386,amd64}.c and correspondent
|
||||
// CreateThread parameter in runtime.newosproc as well.
|
||||
if !iscgo {
|
||||
oh64.SizeOfStackReserve = 0x00010000
|
||||
oh.SizeOfStackReserve = 0x00010000
|
||||
oh64.SizeOfStackCommit = 0x0000ffff
|
||||
oh.SizeOfStackCommit = 0x0000ffff
|
||||
oh64.SizeOfStackReserve = 0x00020000
|
||||
oh.SizeOfStackReserve = 0x00020000
|
||||
oh64.SizeOfStackCommit = 0x00001000
|
||||
oh.SizeOfStackCommit = 0x00001000
|
||||
} else {
|
||||
oh64.SizeOfStackReserve = 0x00200000
|
||||
oh.SizeOfStackReserve = 0x00100000
|
||||
|
@ -282,7 +282,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
|
||||
funcPC(tstart_stdcall), uintptr(unsafe.Pointer(mp)),
|
||||
_STACK_SIZE_PARAM_IS_A_RESERVATION, 0)
|
||||
if thandle == 0 {
|
||||
println("runtime: failed to create new OS thread (have ", mcount(), " already; errno=", getlasterror(), ")")
|
||||
print("runtime: failed to create new OS thread (have ", mcount(), " already; errno=", getlasterror(), ")\n")
|
||||
throw("runtime.newosproc")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user