Add Fiber::Stack#size#16420
Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom Nov 26, 2025
Merged
Conversation
straight-shoota
approved these changes
Nov 25, 2025
Comment on lines
+11
to
+13
| # FIXME: sometimes gc/boehm reports weird stack limits on linux (over | ||
| # 2GB) at least, so we always cast to i32 without overflow checks. | ||
| @size = (@bottom - @pointer).to_i32! |
Member
There was a problem hiding this comment.
thought: 2GB stack size is probably wrong. But would it make sense to use a different type for size? UInt32 for example?
Collaborator
Author
There was a problem hiding this comment.
I don't recall exactly but I think the comment says "over 2GB" to match the i32 limit. It would likely fail just the same with a u32 limit.
Either @pointer and/or @bottom felt like it was a random value. Weirdly enough, only the reported stack pointers are invalid, and the GC still works correctly, which is 🤨
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.
A tiny refactor to save the stack size in the
Fiber::Stackobject, so we can free stacks without assuming the stack's actual size.Extracted from #15885 where the thread pool will have to free stacks outside of execution contexts and thus outside of any stack pool, for example.