top | item 42271431

(no title)

uluyol | 1 year ago

Go stacks are dynamically copied and resized. Stack overflow is not a concern.

discuss

order

cperciva|1 year ago

Oh yuck. Invalidating all the pointers to the stack? That's got to be expensive.

I guess if you're already doing garbage collection moving the stack doesn't make things all that much worse though... still, yuck.

masklinn|1 year ago

Yeah it’s the drawback, originally it used segmented stacks but that has its own issues.

And it’s probably not the worst issue because deep stacks and stack pointers will mostly be relevant for long running routines which will stabilise their stack use after a while (even if some are likely subject to threshold effects if they’re at the edge, I would not be surprised if some codebases ballasted stacks ahead of time). Also because stack pointers will get promoted to the heap if they escape so the number of stack pointers is not unlimited, and the pointer has to live downwards on the stack.