Skip to content

Default Rust thread stack size is 2MB #17044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vadimcn opened this issue Sep 6, 2014 · 2 comments · Fixed by #17292
Closed

Default Rust thread stack size is 2MB #17044

vadimcn opened this issue Sep 6, 2014 · 2 comments · Fixed by #17292

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Sep 6, 2014

According to std::rt::min_stack(), the minimum Rust stack size is 2MB. Given that the default stack size on Windows is 1MB, and that is generally plenty for any program I've seen, this seems a bit excessive.

This, btw, contributes to doctest failure of "futures" example from guide-tasks.md on Windows: this example spawns 1000 threads, and in conjunction with #17043, this results in it running out of memory.

@vadimcn vadimcn changed the title Default rust stack size is 2MB Default Rust thread stack size is 2MB Sep 6, 2014
@thestinger
Copy link
Contributor

The Rust compiler uses a 6MiB stack and then increase than to 20MiB (!!!) when optimizations are disabled. The default stack size on Linux is 8MiB, so that's likely how much is available for the main thread. Rust tends to need a ridiculous amount of stack space, especially without optimizations.

@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 6, 2014

If this is indeed the intended value, at least the test should be adjusted, because right now it's guaranteed to fail on a 32-bit Windows machine, even if the large-address-aware flag were fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants