As I understand it, the garbage collector adjusts isself as the application runs, the threshhold used for example, when objects on the managed heaps are collected is adjusted (according to MSDN) over time.
If an application crashes, does the runtime remember it's previous garbage collection 'settings' or any other settings?
Yes, there's a heuristic in the garbage collector algorithm that makes it automatically adjust the allocation strategy. The most visible side-effect of this is seeing the gen 0 heap size growing as the program is running and consuming memory. Typically starts at 2 MB, it can get to ~8 MB if the program consumes memory rapidly. The performance counters visible in Perfmon.exe are good for this.
The emphasis is very much on "automatic", this code was written with the flat-out assumption that programmers don't have enough information available to them to properly steer the algorithm. The only "hooks" are stuff that the GC cannot know about, like unmanaged memory usage (GC.AddMemoryPressure) or the role of the program (app.exe.config).
The details of the heuristic are not documented. However, you can glean some background info from today's publishing house for software algorithm documentation, the US Patent Office. Most of Microsoft's GC algorithms patents are credited to Patrick Dussud, you can easily find them back with a google query on his name. Here's a relevant one.
No, the runtime doesn't remember it's previous garbage collection 'settings' that its learned during the run.
What you can configure is concurrent garbage collection by putting the following in the config file:
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
Or:
<configuration>
<runtime>
<gcConcurrent enabled="false"/>
</runtime>
</configuration>
Full documentation for gcServer can be found in MSDN.
Full documentation for gcConcurrent can be found in MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With