How can i detect that garbage is running?

  • Thread starter Thread starter baramee
  • Start date Start date
Well, there's a lot of garbage out there...<g> No, seriously though, what is
it you want to achieve? When you kick off a .NET application, garbage
collection IS running.
 
If you open up perfmon - the under the .Net CLR memory - add the counters for Gen X collections and select the process you want to monitor

This give you the absolute number of collections at a moment in time for each generation of the heap. GCs are triggered by memory pressure so an app that is not allocating memory will not cause any GCs.
 
Great feedback. However, my point is that the CLR will administer and
monitor any .NET app started, hence the garbage collector "is running", i.e.
it's invoked when needed.
 
Back
Top