Skip to content

Commit c82b88b

Browse files
authored
Rollup merge of #138757 - rust-wasi-web:wasi-thread-stack-size, r=alexcrichton
wasm: increase default thread stack size to 1 MB The default stack size for the [main thread is 1 MB as specified by linker options](https://github.com/rust-lang/rust/blob/38cf49dde8a5b0b284bb6dffd423d223c9f8f7a3/compiler/rustc_target/src/spec/base/wasm.rs#L14). However, the default stack size for threads was only 64 kB. This is surprisingly small and thus we increase it to 1 MB to match the main thread.
2 parents 240a4da + 38cf49d commit c82b88b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: library/std/src/sys/pal/wasi/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ cfg_if::cfg_if! {
6767
}
6868
}
6969

70-
pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
70+
pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
7171

7272
impl Thread {
7373
// unsafe: see thread::Builder::spawn_unchecked for safety requirements

Diff for: library/std/src/sys/pal/wasm/atomics/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::time::Duration;
66

77
pub struct Thread(!);
88

9-
pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
9+
pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
1010

1111
impl Thread {
1212
// unsafe: see thread::Builder::spawn_unchecked for safety requirements

0 commit comments

Comments
 (0)