New GCCollectionMode in ORCAS

Hi

With orcas there is a new addition to the GC class. There is a new overload being added to the GC class Collect method. The new overload takes two parameters, int Generation and GCCollectionMode.

Here generation is the heighest generation to collect. The value can be anything between 0 and GC.MaxGeneration. Mode can be either default, Forced or Optimized. Default has the same effect as calling the GC.Collect without providing any mode. Forced mode guarantee's a collection for all generation upto and including generation provided in earlier parameter

Optimized mode tells GC to collect only if GC determines it to be productive to collect the Garbage. The productivity of Garbage collection is determined on many factors which includes amount of memory considered garbage, heap fragmentation etc. If GC decides that a garbage collection will not be productive currently then this call has no affect what so ever.

Forced and default modes should be used mainly for debugging or testing purpose, when we want to ensure objects are being collected at a certain point in the application or to compare the performance of the application based on Garbage Application.

Thanks
Vikram


Share this post   Email it |  digg it! |  reddit! |  bookmark it!

Feedback

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 - 2009 Vikram Lakhotia