about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastian Urban <surban@surban.net>2025-03-20 19:08:16 +0100
committerSebastian Urban <surban@surban.net>2025-03-20 19:08:16 +0100
commit38cf49dde8a5b0b284bb6dffd423d223c9f8f7a3 (patch)
treed149fc60eb8dfd2105bbb8490fa5b0e9eb2f4aa6
parentd8e44b722a93e55cbc9a8188dfbfe3faf1226096 (diff)
downloadrust-38cf49dde8a5b0b284bb6dffd423d223c9f8f7a3.tar.gz
rust-38cf49dde8a5b0b284bb6dffd423d223c9f8f7a3.zip
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.
-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