locked
Monitoring the GC RRS feed

  • Question

  • I made a lightweight class for watching activity in the GC by regularly polling collection counts for each generation and comparing to earlier values. It can fire events and also run asynchronously on a separate thread with customizable poll intervals, and it really works.
    I did this because I wanted an easy way to get some sort of notification of GC events when my programs run (not for releases, though), without using the heavy CLR Profiler.
    But the question is, is there already a performance counter offered by the CLR which can fire events? But with a performance counter comes security permissions that might not have been granted.
    Monday, May 28, 2007 5:44 PM

Answers

  • Yes, there are lots of GC performance counters.  No, they can't fire events.  I think security is only an issue if you try to query them remotely.  Run perfmon.exe to see what's available.  The performance object name is ".NET CLR Memory".
    Monday, May 28, 2007 7:30 PM

All replies

  • Yes, there are lots of GC performance counters.  No, they can't fire events.  I think security is only an issue if you try to query them remotely.  Run perfmon.exe to see what's available.  The performance object name is ".NET CLR Memory".
    Monday, May 28, 2007 7:30 PM
  • Thanks for clearing that up. Thus I've done the trivial work with my class.
    Tuesday, May 29, 2007 5:34 AM
  • You could receive such notifications by writing your own CLR Host, and implement the SuspensionStarting/SuspensionEnding from the IHostGCManager interface.

    You can find a more in-depth explanation in this post: Accurately Measuring GC Suspensions

    Saturday, August 7, 2010 1:31 PM