Generation Garbage and Thresholds of Different Generations

I downloaded a free copy of the book Under the Hood of .Net Memory Management . In one of the sections, the author mentions the threshold values โ€‹โ€‹of various generations that will force the GC to collect this particular generation and all other child generations. The exact text is given below:

GC starts automatically in a separate thread in one of the conditions below.

When the size of objects in any generation reaches a threshold specific to generation. To be precise when:

  • General 0 views ~ 256 K
  • Gen 1 reaches ~ 2 MB (at this point GC collects Gen 1 and 0)
  • Gen 2 reaches ~ 10 MB (at this point GC collects Gen 2, 1 and 0)

It should be borne in mind that the above thresholds are simply entry-level, because .NET changes the levels depending on the behavior of the application.

I wanted to know if there is a way to find out what the current threshold value is, for example, Generation-2 for this application during its operation.

+4
source share
1 answer

A similar question is another , and both say no. I don't see anything in the GC class .

+2
source

Source: https://habr.com/ru/post/1413211/


All Articles