ENع
الدرس 19 · Advanced .NET

Memory and the garbage collector

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

In C#, locals live in a method's stack frame and every object made with new lives on the managed heap, which the CLR owns. Follow a seven-line program as it allocates two objects in generation 0, drops one reference, and forces a gen 0 collection: the garbage collector marks what the roots reach, reclaims the rest, compacts and promotes the survivor to gen 1, and updates the reference to it. GC.GetGeneration then prints 1.

14 دقيقة10 خطوات5 أسئلةAdvanced
شكل 19 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.