.net questions
what is garbage collector in .net?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Syed ShanuRank #87 · 23.7K reputationPosted Aug 5, 2015, 6:04 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 5, 2015, 9:02 PM EDT
Munesh SharmaRank #174 · 13.9K reputationPosted Aug 5, 2015, 9:40 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 5, 2015, 9:54 PM EDT
Garbage collection is the automatic process of freeing up (or deallocating) memory which is being taken up by objects your application no longer needs. Most developers know this much at least.
Every time you instantiate an object in .NET some memory is allocated to store that object. But at some point that object may no longer be needed by your application. Only by deallocating its memory does it become available again for your application to reuse. If memory is not deallocated, then sooner or later your application will run out of memory and stop working.
Sudhesh Gnanasekaran36 reputationPosted Aug 6, 2015, 8:57 PM EDT
Swapnil Mache54 reputationPosted Aug 6, 2015, 9:23 PM EDT