Note that there are some explanatory texts on larger screens.

plurals
  1. POUnusual Garbage Collection Patterns
    text
    copied!<p>I'm seeing some unusual garbage collection patterns under .net 4.0 that I can't explain, any advice would be appreciated. </p> <p>At various times in the running of my program the G2 collection count begins to increase and GC % time goes to near 100%. This continues for some time before stopping (please see Performance Monitor screen grab below). During this time a PerfView trace of the CLR GC ETW events shows that a number of long running G2 collections are being triggered back to back with reason 'AllocSmall'. </p> <p>Can anyone shed some light on:</p> <ol> <li>Preciesly what causes an 'AllocSmall' event</li> <li>Why these are directly triggering G2 collection</li> <li>Why these G2 collections are occuring back to back</li> </ol> <p>LowMemory does not appear to be the problem as the GC start events do not carry this as their reason code (<a href="http://msdn.microsoft.com/en-us/library/ff356162.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ff356162.aspx</a>). We have also seen similar situations in which G0 collections occur back to back.</p> <p><strong>Edit:</strong> It's been suggested that the trigger could be some threshold being exceeded. Given there is still available memory I would expect the G2 heap to expand at this point rather than have the GC thrash trying to collect.</p> <p><strong>Edit:</strong> The pictures posted below are much higher resolution than StackOverflow displays - just open the image link directly in a browser tab.</p> <p><img src="https://i.stack.imgur.com/H1WYL.png" alt="Performance Monitor Trace"> <img src="https://i.stack.imgur.com/EcVDy.png" alt="PerfView Event Trace"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload