Git Product home page Git Product logo

Comments (12)

ChrisDenton avatar ChrisDenton commented on August 19, 2024

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.

workingjubilee avatar workingjubilee commented on August 19, 2024

Rust does not override every last platform-specific behavior. To do so would likely be quite harmful.

from rust.

workingjubilee avatar workingjubilee commented on August 19, 2024

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.

workingjubilee avatar workingjubilee commented on August 19, 2024

@biabbas What version of rustc did you test with?

from rust.

workingjubilee avatar workingjubilee commented on August 19, 2024

No repro on x86_64-unknown-linux-gnu.

from rust.

workingjubilee avatar workingjubilee commented on August 19, 2024

Wait, I misapplied some directions.

It... does repro? What.

from rust.

biabbas avatar biabbas commented on August 19, 2024

@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.

biabbas avatar biabbas commented on August 19, 2024

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.

biabbas avatar biabbas commented on August 19, 2024

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.

workingjubilee avatar workingjubilee commented on August 19, 2024

@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.

biabbas avatar biabbas commented on August 19, 2024

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.

workingjubilee avatar workingjubilee commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.