ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل مستخدم محذوف‎
تاريخ النشر: 2013/06/12
Daanish Rumani
من قبل 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

المزيد من الأسئلة المماثلة