.NET தானாகவே மெமரியை garbage collector (GC) மூலம் நிர்வகிக்கிறது — இது managed heap-ல் objects-ஐ allocate செய்கிறது மற்றும் அணுகக்கூடிய அல்லாத objects-ஐ recover செய்கிறது, எனவே நீங்கள் manually memory-ஐ free செய்ய வேண்டியதில்லை. GC-ஐ புரிந்துகொள்ளுதல் (generational, stack/heap split, மற்றும் IDisposable) performance மற்றும் correctness-க்கு முக்கியமாக உள்ளது.
Stack vs heap
Stack → value types (locals), method frames; fast, automatically freed when scope ends.
Heap → reference type objects (class instances); managed by the GC.
A reference variable lives on the stack but points to its object on the heap.
