Firstly, the current gc runtime implementation allows declare 10M arrays on stack. https://github.com/golang/go/blob/cca23a73733ff166722c69359f0bb45e12ccaa2b/src/cmd/compile/internal/escape/escape.go#L2012-L2025 So I anticipate that some user code will make use of this threshold.
Secondly, when I built the Go toolchain, I found there are many 32768 stack uses. Even for 32768, 5 copystack operations are needed. I have just studied the code a little deeper, and I confidently think line 1067 should be for newsize-(gp.stack.hi - gp.sched.sp) < max+_StackGuard Instead. With this change, the time needed to build the toolchain is reduced to 2m40.123s (from 3m3.897s). On Thursday, July 1, 2021 at 8:42:41 AM UTC-4 Jan Mercl wrote: > On Thu, Jul 1, 2021 at 2:34 PM tapi...@gmail.com <tapi...@gmail.com> > wrote: > > > It is not rare a function will use 10M+ stack. > > What's the source of this claim? If it's not rare, it should be easy > to find an example in the stdlib, I guess. Do you know of one? > > Note that stacks of such size, if common in the wild, would > significantly limit the number of goroutines a process can handle. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/aa2b50ca-209a-4f78-b5e4-5a0399c07231n%40googlegroups.com.