| ▲ | Yokohiii 4 days ago | |||||||||||||||||||||||||
Escape analysis accounts for size, so it wouldn't even permit it. The initial stack size seems to be 2kb, a more on a few systems. So far I understand you can allocate a large local i.e. 8kb, that doesn't escape and grow the stack immediately. (Of course that adds up if you have a chain of calls with smaller allocs). So recursion is certainly not the only concern. | ||||||||||||||||||||||||||
| ▲ | foldr 4 days ago | parent [-] | |||||||||||||||||||||||||
For that to be a problem you either have to have one function that allocates an enormous number of non-escaping objects below the size limit (if the Go compiler doesn't take the total size of all a function's non-escaping allocations into account – I don't know), or a very long series of nested function calls, which in practice is only likely to arise if there are recursive calls. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||