Get-notified-when-garbage-collections-happens

added by skpananghat
8/5/2011 8:44:28 PM

124 Views

This is a code snippet which i got from Jeffrey Richters blog. This code offers a way to raise notification event when a garbage collection occurs on Generation 0 or Generation 2 object Here is the code for the class:


2 comments

dpeterson
8/5/2011 9:23:07 PM
There doesn't seem to be a link to the original article in that post, so I'm wondering what the benefit to having this is? I know that sometimes garbage collection can cause performance droops in your application, but knowing that it's coming doesn't really provide any benefit (that I can see).

Just curious :-)

vijayst
8/6/2011 4:03:49 AM
Knowing about Garbage collection is very useful for resolving performance problems in .Net. It will be helpful if the author has explained more about generation 0..2 objects. This is because not all readers will understand what generation means when it comes to GC.