.NET ఒక గార్బేజ్ కలెక్టర్ (GC) ద్వారా మెమరీని ఆటోమేటిక్గా నిర్వహిస్తుంది — ఇది లిఙ్కులను నిర్వహించిన హీప్లో ఒక వస్తువులను కేటాయిస్తుంది మరియు ఇకపై చేరుకోయని ఆ వస్తువులను తిరిగి సంపాదిస్తుంది, కాబట్టి మీరు మెమరీని మానవీయంగా విడుదల చేసుకోవలసిన అవసరం లేదు. GC (జనరేషనల్, స్టాక్/హీప్ స్ప్లిట్, మరియు IDisposable) గురించి అర్థం చేసుకోవడం పనితీరు మరియు సరిభద్రతకు ముఖ్యమైనది.
స్టాక్ vs హీప్
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.
