Skip to main content

Explain GC Generations, LOH, and POH behavior.

Expert .NET Core
Quick Answer Gen0 collects short-lived objects รขโ‚ฌโ€ collected frequently, fast. Gen1 is a buffer between Gen0 and Gen2. Gen2 collects long-lived objects รขโ‚ฌโ€ full GC, expensive. LOH (Large Object Heap, objects >= 85KB) collects during Gen2 and isn't compacted by default (fragmentation risk). POH (Pinned Object Heap, .NET 5+) stores objects pinned for native interop safely.

Answer

Gen0 handles short-lived objects, Gen1 buffers promotions, and Gen2 manages long-lived objects. LOH (>=85 KB) is collected only during full GC. POH isolates pinned objects to avoid LOH fragmentation. GC modes include server, workstation, and background.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice