2 ms·
> This point confuses me; if Rust expects to run on a limited stack, why would it expect to put a ton of data on the stack? Rust runs on a C stack, while it's
by masklinn 9y ago
> This point confuses me; if Rust expects to run on a limited stack, why would it expect to put a ton of data on the stack?
Rust runs on a C stack, while it's not infinite[0] it's a whole other ballpark than a Go stack since it's non-growable (Rust used to use growable stacks before 1.0): the default C stack size is in the megabyte range (8MB virtual on most unices[1]), in Go the initial stack is 2kB (since 1.4, 8k before).
[0] you can set the size to "unlimited", systems will vary in their behaviour there, on my OSX it sets the stack size to 64MB, Linux apparently allows actual unlimited stack sizes but I've no idea how it actually works to provide that
[1] I think libpthread defines its own stack size circa 2MB so 8MB would be the stack of your main thread and 2MB for sub-threads, but I'm not actually sure