Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What are generations and how are they used by the garbage collector?

user-image
Question added by Deleted user
Date Posted: 2013/06/12
Daanish Rumani
by Daanish Rumani , Product Manager , Publicis Sapient

The garbage collector (GC) organises object in the heap into three generations based on their shelf life.
Generation0 consists of objects with the least shelf life and Generation2 of objects that tend to have the most shelf life.
Initially every object is classified by the GC in Gen0.
If the object survives garbage collection when GC attempts to free memory it is promoted to Gen1.
An object may survive collection if it being used in the application.
Similarly an object in Gen1 that survives collection is promoted to Gen2.
Because running the GC is time intensive the GC runs only when it is in need of memory.
Further the GC collects Gen0 more often than Gen1 which it collects more often than Gen2.
Detailed information from Microsoft itself at http://msdn.microsoft.com/en-us/library/ee787088.aspx

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.