📎 Webclip
The history of the GC configs
The post traces how GC configuration in .NET moved from a very small set of officially supported options to a broader set across .NET 4.x and Core 3.0. It also explains why some settings were added only for specific workloads, why env vars and startup flags were used, and why supported configs should stay understandable with general performance knowledge rather than internal GC details.
Reading notes#
- Early .NET exposed very few public GC configs, mainly gcServer and gcConcurrent, plus a startup flag for retaining the VM.
- App configs under the runtime element were the main official way to configure the CLR.
- COMPlus environment variables existed, but they were used mostly for internal testing and were not documented as app configs.
- Startup flags through the hosting API were rare, and many customers avoided them.
- For app-configurable settings, the runtime could read values from app config, env vars, or registry values.
- In .NET 4.x, new public configs were added for cases such as CPU groups and objects larger than 2 GB.
- Around .NET 4.6, more configs were added for stressful workloads, including GCHeapCount, GCNoAffinitize, and GCHeapAffinitizeMask.
- After coreclr was open sourced, the split between internal and officially supported configs remained, though the boundary became easier to see.
- Core changed how config values were read, so runtimeconfig.json and environment variables use different lookup paths.
- Core 3.0 unified the source, making .NET GC configs available on Core as well.
- Later additions included GCHeapHardLimit, GCLargePages, and GCHeapAffinitizeRanges.
- Values passed through env vars are interpreted as hexadecimal, not decimal.
- The author argues that supported configs should be based on general memory and CPU knowledge, not on detailed internal GC behavior.
- The author does not want configs that require users to choose collection behavior based on generation-specific internal heuristics.
