-
Notifications
You must be signed in to change notification settings - Fork 951
Be smarter of stack<->heap allocations for "larger" systems. #3331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@aykevl I want to fix this; do you have any suggestions for how to determine a "large' vs "small" system. I was thinking for non-small systems to bump the max stack allocation size to 1024 bytes. |
The default stack size is known to the compiler, you could check whether the stack is at least 8kB or so before you allow larger objects to be allocated on the heap. |
Seems easy enough. I'll give it a shot. |
Hmm... guess the compiler is only one half of this, since we need need to get that value to the runtime somehow so we can tune the value of
|
@dgryski huh, why does the runtime need to know this? Is it just so that |
Yes, that was one of my goals for this. The size of that stack drastically affects the runtime of the garbage collection cycles. |
We could add a magic function call that returns the configured default stack size, and then allocate the array using That said, I'm thinking of adding a generic way to get system configuration variables that can be read from the runtime or elsewhere. This is mainly intended as a way to get board-specific variables into the runtime and machine packages (things like crystal oscillator configuration), but could also be used for the default stack size. |
Since #2628 , all allocations larger than 256 bytes are moved to the heap. This might not make sense on systems where the default stack size is larger.
This would also allow a larger work queue size for the garbage collector's mark phase which will reduce the number of full heap rescans on overflow.
The text was updated successfully, but these errors were encountered: