Tuesday, September 25, 2012

.Net Garbage Collection

Tring to understand garbage collection, as it does cause high CPU on high usage sites
Some pointers
* there are Gen 0, 1 and 2 containers
* when GC starts it will clean up 'Gen 0' containers, any object that is still refereed by the app, will be moved to 'Gen 1'
* GC when start it will clear 'Gen 0', then 'Gen 1', any object still in use is moved to 'Gen 2'
* GC spends more time in Gen 0, then 1 or 2
* the more the objects are 'Gen 1' or 2, the worst it is, as memory is allocated, but can never be cleared, hence the memory cannot be claimed.
* so its a good sign to have more object in 'Gen 0' and very few in 1&2


No comments: