Skip to content
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

std::thread docs are unclear regarding stack sizes #102671

Closed
steveklabnik opened this issue Oct 4, 2022 · 0 comments · Fixed by #104537
Closed

std::thread docs are unclear regarding stack sizes #102671

steveklabnik opened this issue Oct 4, 2022 · 0 comments · Fixed by #104537
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@steveklabnik
Copy link
Member

Location

https://doc.rust-lang.org/std/thread/#stack-size

Summary

This says

The default stack size for spawned threads is 2 MiB, though this particular stack size is subject to change in the future.

This is not correct, because it implies this is true for all platforms, but each platform sets their own default stack size. Even amongst unices, 2mib isn't always the case.

#[cfg(not(any(target_os = "l4re", target_os = "vxworks", target_os = "espidf")))]
pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024;
#[cfg(target_os = "l4re")]
pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
#[cfg(target_os = "vxworks")]
pub const DEFAULT_MIN_STACK_SIZE: usize = 256 * 1024;
#[cfg(target_os = "espidf")]
pub const DEFAULT_MIN_STACK_SIZE: usize = 0; // 0 indicates that the stack size configured in the ESP-IDF menuconfig system should be used

@steveklabnik steveklabnik added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Oct 4, 2022
@bors bors closed this as completed in ddb1234 Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant