Skip to content

Clarify that RUST_MIN_STACK may be internally cached #109225

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

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Clarify that RUST_MIN_STACK is internally cached
For larger applications it's important that users set `RUST_MIN_STACK`
at the start of their program because `min_stack` caches the value.
Not doing so can lead to their `env::set_var` call surprisingly not having any effect.
  • Loading branch information
seanlinsley authored Mar 16, 2023
commit 54567efda7c08d04383001456976f0f2e43bbfbd
3 changes: 2 additions & 1 deletion library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
//!
//! * Build the thread with [`Builder`] and pass the desired stack size to [`Builder::stack_size`].
//! * Set the `RUST_MIN_STACK` environment variable to an integer representing the desired stack
//! size (in bytes). Note that setting [`Builder::stack_size`] will override this.
//! size (in bytes). Note that setting [`Builder::stack_size`] will override this. Also, note
//! that `RUST_MIN_STACK` is cached internally so should be set before any threads are started.
//!
//! Note that the stack size of the main thread is *not* determined by Rust.
//!
Expand Down