about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-29 11:43:46 +0100
committerGitHub <noreply@github.com>2025-03-29 11:43:46 +0100
commitc82b88b009b7053ac8fcdbac8ad0c0c42d8305d5 (patch)
tree1e29d245c35600ca872261e25bbdccda39862792
parent240a4da396f12f7f6893c17cb59613c9bb850308 (diff)
parent38cf49dde8a5b0b284bb6dffd423d223c9f8f7a3 (diff)
downloadrust-c82b88b009b7053ac8fcdbac8ad0c0c42d8305d5.tar.gz
rust-c82b88b009b7053ac8fcdbac8ad0c0c42d8305d5.zip
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.
-rw-r--r--library/std/src/sys/pal/wasi/thread.rs2
-rw-r--r--library/std/src/sys/pal/wasm/atomics/thread.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/pal/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs
index c85b03d4a89..cc569bb3daf 100644
--- a/library/std/src/sys/pal/wasi/thread.rs
+++ b/library/std/src/sys/pal/wasi/thread.rs
@@ -67,7 +67,7 @@ cfg_if::cfg_if! {
     }
 }
 
-pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
+pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
 
 impl Thread {
     // unsafe: see thread::Builder::spawn_unchecked for safety requirements
diff --git a/library/std/src/sys/pal/wasm/atomics/thread.rs b/library/std/src/sys/pal/wasm/atomics/thread.rs
index afdb159fe6f..dd5aff391fd 100644
--- a/library/std/src/sys/pal/wasm/atomics/thread.rs
+++ b/library/std/src/sys/pal/wasm/atomics/thread.rs
@@ -6,7 +6,7 @@ use crate::time::Duration;
 
 pub struct Thread(!);
 
-pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
+pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024;
 
 impl Thread {
     // unsafe: see thread::Builder::spawn_unchecked for safety requirements