Repository navigation
On Windows a Ruby program and its threads get 8 MB stacks - #154
Merged
Merged
Conversation
Windows gives a process's main thread 1 MB of stack and other threads 1.5 MB; Linux and macOS give 8 MB. A Ruby recursion went a seventh as deep as in CRuby there: 1,586 levels of a JIT-compiled method against 10,916. ir runs the program on a thread with 8 MB (single-threaded apartment, as Main is), and Thread.new threads get 8 MB everywhere. Windows now: 16,541 levels on the main thread, 18,794 in a thread; CRuby 10,916 and 10,918. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 47 minutes. View limit details
|
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #129. On Windows a Ruby recursion went about a seventh as deep as in CRuby: Windows gives a process's main thread 1 MB of stack and other threads 1.5 MB, while Linux and macOS give 8 MB. Since #150 such a recursion raises a rescuable
SystemStackError, but it raised it much too early.irruns the program on a thread with an 8 MB stack on Windows (Program.cs). The thread is a single-threaded apartment, asMainis, for Windows Forms and WPF. It starts on a named method marked[RubyStackTraceHidden], so backtraces do not show it. Ctrl-C reaches the program becauseCreateConsoletakes the thread it runs on.Thread.newthreads get 8 MB on every platform (RubyUtils.ThreadStackSize). On Linux that is what they had already. The memory is reserved, not committed.Maximum recursion depth on Windows (net10.0, Windows 11 VM)
Thread.new[1].each { f }), main threadLinux is unchanged: 21,894 levels for a JIT method on the main thread, 25,364 in a thread.
Testing
Util/parallel-sweep.sh: same counts as before (core 44, library 0, language 1, command_line 0, security 2).exit 3returns 3 and runsat_exit,Thread.main == Thread.currentholds, and a raised error's backtrace has no extra frame.Not in this PR
Process.kill(:INT, Process.pid)raisesSignalExceptionin IronRuby, where CRuby raisesInterrupt(rescuable as such). This is older than this change.Ractor_DeepGraph1stays at 1,000 levels: IronRuby.Tests runs on its own threads, not onir's.🤖 Generated with Claude Code