aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 1fa235bf86..54ad66dca2 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -1061,7 +1061,9 @@ func newstack() {
// recheck the bounds on return.)
if f := findfunc(gp.sched.pc); f.valid() {
max := uintptr(funcMaxSPDelta(f))
- for newsize-gp.sched.sp < max+_StackGuard {
+ needed := max + _StackGuard
+ used := gp.stack.hi - gp.sched.sp
+ for newsize-used < needed {
newsize *= 2
}
}