diff options
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/runtime/proc.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index c0e85773098..e3f934ae7bd 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -563,6 +563,14 @@ func schedinit() { sched.lastpoll = uint64(nanotime()) procs := ncpu + + // In 32-bit mode, we can burn a lot of memory on thread stacks. + // Try to avoid this by limiting the number of threads we run + // by default. + if sys.PtrSize == 4 && procs > 32 { + procs = 32 + } + if n, ok := atoi32(gogetenv("GOMAXPROCS")); ok && n > 0 { procs = n } |