Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: stack overflow accessing large return value #14028
Taken this toy example, that calculates prime numbers: http://play.golang.org/p/XrUCUvC7In
Building this with go build -gcflags -m shows following outputmoved to heap: arr moved to heap: x
However, running the program I get following error:
runtime: goroutine stack exceeds 1000000000-byte limit
goroutine 1 [stack growth]:
Is it supposed to get a stackoverflow, if it is a heap object?
Go version: go1.5.3 windows/amd64
referenced this issue
Jan 20, 2016
Did you know that
Per the Go ABI, the return value will be passed on stack,
Discussion about the
The issue seems to be that when we're warning about stack frames that are >1GB, we're failing to include the space reserved for calling other functions. In the example above, main needs to allocate 1GB of stack space for fn's return values, but we're not including that space in the test.