none
Garbage Collector questions RRS feed

  • Question

  • Hi,

    I have two questions about garbage collection :

    1 : Is it one background thread runnning for all generations? or is it one GC thread for Gen 0, one for Gen 1 , one for Gen 2? or is it a different conecpt all together?

    2 : I know that everytime a GC runs for generation 0, it will take a lot less time to run for Gen 1, and even more for Gen 2. Does anyone know the exact time difference between different generation? as in if for every ms GC runs for generation 0, is it a thousand ms till ir tuns for gen 1? I rememebr reading that its an arithmatic graph.

    If you have links to some articles talking about these issues please provide links to them.

    Thanks.

    Friday, August 24, 2012 7:09 AM

Answers

  • Hi kalamantina,

    1. There is only one thread that triggers the GC, which causes other thread to get suspended for time being.

    2. To determine the length of time in Garbage Collection, you can examine the % Time in GC memory performance counter. 

    The value is calculated by using a sample interval time. Because the counters are updated at the end of each garbage collection, the current sample will have the same value as the previous sample if no collections occurred during the interval.

    Collection time is obtained by multiplying the sample interval time with the percentage value.

    The following data shows four sampling intervals of two seconds, for an 8-second study. The Gen0Gen1, and Gen2 columns show the number of garbage collections that occurred during that interval for that generation.

    Interval    Gen0    Gen1    Gen2    % Time in GC
           1       9       3       1              10
           2      10       3       1               1
           3      11       3       1               3
           4      11       3       1               3
    

    Regards, http://www.shwetalodha.blogspot.in/

    Friday, August 24, 2012 3:56 PM