I downloaded a free copy of the book "Under the hood of .Net Memory Management". In one of the chapter, author mentions the threshold values of various generations which will force the GC to collect that particular generation and all the other child generations. Exact text given below :
The GC runs automatically on a separate thread under one of the conditions below.
When the size of objects in any generation reaches a generation-specific threshold. To be precise, when:
- Gen 0 hits ~256 K
- Gen 1 hits ~ 2 MB (at which point the GC collects Gen 1 and 0)
- Gen 2 hits ~10 MB (at which point the GC collects Gen 2, 1 and 0)
It's worth bearing in mind that the above thresholds are merely starting levels, because .NET modifies the levels depending on the application's behavior.
I wanted to know if there is a way to figure out as what is the current threshold value of say Generation-2 for a given application while it is running.