.NET ngelola memori kanthi otomatis liwat garbage collector (GC) — ngewacakake obyek ing managed heap lan mulang obyek sing ora bisa digayuh maneh, dadi sampeyan ora kudu ngosongake memori kanthi manual. Ngerti GC (generational, pembagian stack/heap, lan IDisposable) penting kanggo performance lan 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.
