mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-07 13:15:23 +00:00
windows: Use a default stack size of 8MB (#8711)
This matches Linux and avoids annoying stack overflows, especially when running our own demos (see printerdemo). This is now also documented for our users. Fixes #4586
This commit is contained in:
parent
52c978238e
commit
2ea583d9d9
2 changed files with 30 additions and 0 deletions
|
@ -19,3 +19,12 @@ rustflags = [
|
|||
"-C",
|
||||
"target-feature=+s32c1i",
|
||||
]
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
# Increase default stack size to avoid running out of stack
|
||||
# space in debug builds. The size matches Linux's default.
|
||||
rustflags = ["-C", "link-arg=/STACK:8000000"]
|
||||
[target.aarch64-pc-windows-msvc]
|
||||
# Increase default stack size to avoid running out of stack
|
||||
# space in debug builds. The size matches Linux's default.
|
||||
rustflags = ["-C", "link-arg=/STACK:8000000"]
|
||||
|
|
|
@ -63,6 +63,27 @@ your Python script.
|
|||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Rust: Stack Overflows
|
||||
|
||||
When developing Rust applications on Windows, you might sooner or later observe the program aborting with `STATUS_STACK_OVERFLOW`,
|
||||
especially in debug builds. This is a known issue that's a combination of a high demand for stack space and MSVC defaulting to
|
||||
a stack size for the main thread that's significantly smaller compared to other operating systems.
|
||||
|
||||
This is fixed by configuring the linker. Create a [`.cargo\config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#configuration)
|
||||
file in your project (note the `.cargo` sub-directory) with the following contents:
|
||||
|
||||
```toml
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
# Increase default stack size to avoid running out of stack
|
||||
# space in debug builds. The size matches Linux's default.
|
||||
rustflags = ["-C", "link-arg=/STACK:8000000"]
|
||||
[target.aarch64-pc-windows-msvc]
|
||||
# Increase default stack size to avoid running out of stack
|
||||
# space in debug builds. The size matches Linux's default.
|
||||
rustflags = ["-C", "link-arg=/STACK:8000000"]
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="macOS" icon="apple">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue