Is it possible to determine when the Garbage collection runs?
Posted on 2006-05-10
I am analyzing my code(in a GUI app) to determine in which step the delay is occuring. To do so, I am printing out the time stamp in "ss.fff" format to print the milliseconds. What i found is that there is more than 100 ms delay occuring in the 10 steps of the code. The delay is not occuring at the same point all the time. Sometimes the delay occurs between steps 2 and 3, sometime between 6 &7 and sometimes in between 9 & 10. Also the delay is not always constant and varies from 100 to 400 ms. The entire code is in a single method and is accessing objects existing in the current thread. I m suspecting that the garbage collection might be running in between. Is it possible to figure out when the garbage collection occurs in C#?