How expensive is a garbage collection?
The cost of performing a garbage collection is a function of the number of live reference types your application has allocated. Each time a collection occurs, the GC traverses the graph of objects looking for those that aren’t referenced anymore. Objects that are no longer referenced are marked and then later freed. Keep in mind that those objects that have finalizers are not immediately freed. Instead, they are placed on a finalization queue where their finalizers get run by a background thread. These objects are then freed the next time the GC runs. You can determine how much time the GC spends doing collections by looking at the “GC Latency Time” performance counter in mscoree.stat (see Developing Well Performing .NET Compact Framework Applications for details on how to use the counters provided by the .