Search code examples
c#memorygarbage-collection

Measuring memory pressure/GC execution in C#


Is there any way I can measure the memory pressure caused by a program, and how many times the GC is being executed in background?


Solution

  • Yes, by using the .Net performance counters.

    For programmatic access to those, see msdn.microsoft.com/en-us/library/356cx381.aspx.