Skip to content

Windows: 1 MB thread stacks limit recursion depth (Ractor copy, Ruby recursion) well below CRuby's #129

Closed

Description

@Largo

On Windows a thread's stack is 1 MB (ironruby.exe's main thread and Thread.new threads alike, as far as observed); Linux's main thread has 8 MB. Recursive walks in the runtime reach correspondingly less depth on Windows:

CRuby on Windows links ruby.exe with a larger stack reserve than the 1 MB default, so programs that recurse moderately deep work there and not on IronRuby.

Options:

  • Give ironruby.exe/ir.exe a larger stack reserve (PE header, e.g. via editbin /STACK after build, or run the main script on a thread created with a larger maxStackSize, as StackGuard already does for prism walks).
  • Create Thread.new threads with a larger maxStackSize.
  • For the Ractor copier specifically, continue on StackGuard.RunOnLargeStack when the stack runs low (careful: initialize_copy would then run Ruby code on another CLR thread).

Activity

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