Comments (12)
The default stack size of new threads is 2 MiB. However, the default stack size of the main thread varies depending on the platform and possibly platform-dependent build configuration.
from rust.
Rust does not override every last platform-specific behavior. To do so would likely be quite harmful.
from rust.
Actually, wait. I'm confused. For rustc, this shouldn't matter because of the DEFAULT_STACK_SIZE (not to be confused with the default stack size).
from rust.
@biabbas What version of rustc did you test with?
from rust.
No repro on x86_64-unknown-linux-gnu.
from rust.
Wait, I misapplied some directions.
It... does repro? What.
from rust.
@biabbas What version of rustc did you test with?
I was able to reproduce this behavior on rust 1.75, 1.78, 1.79 stable.
from rust.
The default stack size of new threads is 2 MiB. However, the default stack size of the main thread varies depending on the platform and possibly platform-dependent build configuration.
You are right, default stack size for new threads is 2mb. I went through the std thread code and I see that min_stack uses this RUST_MIN_STACK variable to influence the size of thread builder stack size. In the test case what stack is overflowed and why RUST_MIN_STACK workaround fixes it?
from rust.
Actually, wait. I'm confused. For rustc, this shouldn't matter because of the DEFAULT_STACK_SIZE (not to be confused with the default stack size).
Could you please elaborate and differentiate between the two.
from rust.
@biabbas DEFAULT_STACK_SIZE
is a constant used by rustc to set the thread builder's stack amount, the "default stack size" we've mentioned in a few cases in this thread is the platform's implicit stack size for the main thread.
from rust.
Can rustc be using parallelism( sub threads with limit around 2mb) for program compilation? In that case the error message should emit the actual stack that is overflowed. I know cargo uses parallelism for build but not sure if rustc also uses this.
I had access to reproduce and work on #113612. This example would compile with RUST_MIN_STACT set to 3mb.
Maybe the thread builder stack size is overwriting the main threads stack size, in which case it needs a fix.
from rust.
Yes, we deliberately set the stack size by spawning a thread.
However, I would expect we are setting it to 8MB.
We emit a suggestion that suggests setting RUST_MIN_STACK
to double the previous value.
from rust.
Related Issues (20)
- Compiler marks import as unnecessary when it isn't (panic_handler) HOT 4
- Corrupted data trashes the output HOT 8
- Confusing CI error when compiler build fails HOT 8
- unreachable pattern lint should report some (or all) of the earlier match arms that subsume the unreachable one HOT 6
- Compiler unexpectedly panicked - async HOT 4
- ICE: `unexpected value of coverage attribute` HOT 1
- ICE: `typeid_for_instance: couldn't get fn_abi of instance`
- High failure rate on Windows MSVC CI with filesystem errors HOT 3
- `#[expect(unused_imports)]` does not work correctly on grouped imports HOT 8
- Solve the pinned memchr problem
- `doctest` line number is incorrect if used with #![doc = include_str!()] HOT 6
- `tests/run-make/print-target-list` fails for csky-unknown-linux-gnuabiv2 HOT 3
- Missing implied bound raises misleading error message HOT 3
- Tracking issue for pub_use_of_private_extern_crate future-compatibility lint
- Degradation from rustc 1.71.0 -> 1.79.0 ("infinite space" compile error not recognized anymore) HOT 6
- type alias `Plus2` is never used HOT 10
- The Android CI prints unrelated things to stdout, ruining check-run-results tests. HOT 2
- conflicting errors: `index out of bounds` HOT 2
- ICE: delegation: `unexpected parent of trait or impl item or item not found` HOT 1
- run-make: revise rmake.rs setup in compiletest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.