On Windows the maximum size of the main thread's stack should at least match that of new threads #85303
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
O-windows
Operating system: Windows
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
On Windows an area of virtual memory is reserved for the main thread's stack to grow in to. The size of this area is requested by the application via the binary's header. Currently Rust does not set the size of this reserved area so instead the linker uses a fallback value (often only 1 MiB).
I think Rust should set the maximum stack size to at least match the default size for new threads (if not larger). This can be done via linker flags. E.g. reserving 16 MiB of virtual memory for stack space is done using
/STACK
argument on MSVC:/STACK:16777216
And on Mingw it's
--stack
:-Wl,--stack,16777216
However, if Rust does set the stack size it would need a way to override this value. Perhaps via a
-C
codegen option?The text was updated successfully, but these errors were encountered: