Skip to content

Default Rust thread stack size is 2MB #17044

Closed

Description

@vadimcn

According to std::rt::min_stack(), the minimum Rust stack size is 2MB. Given that the default stack size on Windows is 1MB, and that is generally plenty for any program I've seen, this seems a bit excessive.

This, btw, contributes to doctest failure of "futures" example from guide-tasks.md on Windows: this example spawns 1000 threads, and in conjunction with #17043, this results in it running out of memory.

Activity

  1. changed the title [-]Default rust stack size is 2MB[/-] [+]Default Rust thread stack size is 2MB[/+] on Sep 6, 2014
  2. thestinger commented on Sep 6, 2014

    @thestinger
    Contributor

    The Rust compiler uses a 6MiB stack and then increase than to 20MiB (!!!) when optimizations are disabled. The default stack size on Linux is 8MiB, so that's likely how much is available for the main thread. Rust tends to need a ridiculous amount of stack space, especially without optimizations.

  3. vadimcn commented on Sep 6, 2014

    @vadimcn
    ContributorAuthor

    If this is indeed the intended value, at least the test should be adjusted, because right now it's guaranteed to fail on a 32-bit Windows machine, even if the large-address-aware flag were fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions