Skip to content

Commit 38cf49d

Browse files
committed
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. 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.
1 parent d8e44b7 commit 38cf49d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

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)