-
-
Couldn't load subscription status.
- Fork 23.5k
Description
Tested versions
- Reproducible in: 4.6.dev [0fdb93c]
System information
Godot v4.6.dev (0fdb93c) - macOS Tahoe (26.0.1) - Multi-window, 1 monitor - Metal (Forward+) - integrated Apple M2 Pro (Apple8) - Apple M2 Pro (10 threads) - 32.00 GiB memory
Issue description
Apple platforms (e.g. macOS, iOS) use a default stack size of 512 KiB for secondary threads. This is unlike most other platforms where it instead is at least 1 MiB.
We currently increase the stack size for WorkerThreadPool threads specifically on Apple platforms, in order to not run into stack overflows as a result of SPIRV-Cross, as seen here:
godot/core/object/worker_thread_pool.cpp
Lines 367 to 378 in 0fdb93c
| Thread::Settings settings; | |
| #ifdef __APPLE__ | |
| // The default stack size for new threads on Apple platforms is 512KiB. | |
| // This is insufficient when using a library like SPIRV-Cross, | |
| // which can generate deep stacks and result in a stack overflow. | |
| #ifdef DEV_ENABLED | |
| // Debug builds need an even larger stack size. | |
| settings.stack_size = 2 * 1024 * 1024; // 2 MiB | |
| #else | |
| settings.stack_size = 1 * 1024 * 1024; // 1 MiB | |
| #endif | |
| #endif |
This however does nothing to resolve the problem for threads spawned from scripts (i.e. Thread), where you're still more likely to run into a stack overflow on Apple platforms.
Steps to reproduce
- Build a non-optimized editor build for macOS (i.e.
target=editor dev_build=yes). - Run the main scene in the MRP.
- Note the crash.
- Build a non-optimized editor build for Windows or Linux.
- Run the main scene again.
- Note how there's no crash.
Minimal reproduction project (MRP)
Metadata
Metadata
Assignees
Type
Projects
Status