Monitoring the CLR Garbage Collection

Not something many .net programmers I know worry about, I've found recently though it's definitely worth spending some time monitoring the way the CLR reclaims memory from managed resources returning it to the managed heap during an applications execution.  Slight code changes can give big performance benefits as CLR garbage collection happens on it's own thread, monitoring it is a simple process. 

The Windows tool Perfmon.exe has a nice trick up its sleeve whereby you can add performance counters for ".NET CLR Memory" using the + button on the toolbar. This gives a coloured line on the graph representing the percentage of cpu time spent garbage collecting.

A few well placed System.GC.Collect() calls in the code can make a windows forms app feel more responsive, simple but effective.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Tuesday, September 05, 2006 9:01 AM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Neil Smith

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski