Dynamically sized stack

Hey folks,

as far as I know you have e.g. in Go a stack which is dynamically sized so it can grow and shrink. Out of curiosity I was wondering if you could have this also in Rust but the only thing I found was this post here. Meanwhile that's more than 6 years ago. Does anybody know if something has changed since then?


Rust does grow the stack on operating systems that support it. The stack is contiguous, and expanded "in-place" by mapping more virtual memory to it.

Old golang and very old Rust 0.x used to have segmented stacks, that were grown and shrunk like a linked list. That was problematic for compatibility with C code, and had serious performance problems when loops happened to grow and shrink the stack on every iteration. Golang removed segmented stacks in 1.4.


Thanks for your answer! :slight_smile: Meanwhile I've also found this relating topic. The nosplit pragma from Go mentioned there led me to ask myself how Rust behaves here.