Explain all GC generations and what makes Gen2 and LOH behave differently.

Expert C#

Answer

Generations:

  • Gen0: short-lived objects.
  • Gen1: buffer generation.
  • Gen2: long-lived objects; full GC expensive.
  • LOH: >= 85KB, collected only in full GC.
  • POH introduced for pinned objects.
  • GC modes: Server, Workstation, Concurrent.

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