Uh oh!
There was an error while loading. Please reload this page.
Allow stack size to be configured - #110455
Conversation
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Dec 6, 2024
We have (undocumented) |
Uh oh!
There was an error while loading. Please reload this page.
keegan-caruso
commented
Dec 6, 2024
Thanks. This works on Windows, it is not working for me on Linux. On windows I checked against kernel32 GetCurrentThreadStackLimits. On linux I checked against strace. |
jkotas
commented
Dec 8, 2024
It works for musl libc (musl libc is used e.g. by Alpine Linux). glibc that is used by the most popular Linux distros like Ubuntu does not respect value set by |
jkotas
commented
Feb 10, 2025
Github status is stuck in "Checking for ability to merge automatically…". Could you please rebase against main and force push? Hopefully, it is going to reset the status. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
94b687c to
b6fd3f7CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I think we should look at this in the context of #113344: Here's a couple questions I have:
If so, I can add the CoreCLR version so that we can also resolve #113344 and we can doc it. Cc @kouvel@AaronRobinsonMSFT for opinion |
am11
commented
Mar 13, 2025
The naming looks good as it's consistent with: |
AaronRobinsonMSFT
commented
Mar 13, 2025
@MichalStrehovsky See #113344 also.
I didn't see the
This was a source of confusion on a partner team who had been assuming it was radix 10 for about 6 years. I think having it as radix 16 is fine, but we need to document this properly at https://learn.microsoft.com/dotnet/core/runtime-config/threading. |
AaronRobinsonMSFT
commented
Mar 13, 2025
Seems reasonable to me. |
It's |
kouvel
commented
Mar 20, 2025
CoreCLR already has a |
MichalStrehovsky
commented
Jul 22, 2025
Made this change and standardized on I left DEFAULT_STACK_SIZE as is. We could probably delete it in favor of the new System.Threading.DefaultStackSize. |
MichalStrehovsky
commented
Jul 24, 2025
@VSadov is this something you'd be able to review? Could you please have a look? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Jul 25, 2025
We still read |
jkotas
commented
Jul 25, 2025
My point is that we have changed |
| if (g_pRhConfig->ReadConfigValue("Thread_DefaultStackSize", &uiStacksize) | ||
| || g_pRhConfig->ReadKnobUInt64Value("System.Threading.DefaultStackSize", &uiStacksize)) | ||
| { | ||
| if (uiStacksize < maxStack || uiStacksize >= minStack) |
There was a problem hiding this comment.
Why || and not &&. I assume it is always true now?
MichalStrehovsky
commented
Jul 25, 2025
Good catch! #118076 |
EDIT: this has been extended to also work with CoreCLR-VM so that we can resolve#113344 with it.
If a native AOT compiled application can lower its allocated memory, more scenarios that are memory sensitive can use it.
The default stack size can be excessive for simple applications and can significantly contribute to the RSS.
For linux, there is the ulimit command, and this is respected, but it can be too broad.
With this trivial code:
On linux with the default stack size of 8mb, RSS measured at 5916.
With setting the stack size to 1mb, the RSS measured at 3428.
Roughly a 40% decrease.