Garbage Collection

suggest change

Versions

The garbage collector has been part of the .NET Framework since 1.0. The behavior described here applies through 4.6.2.

Introduction

In .NET, objects created with new are allocated on the managed heap. The program does not free that memory itself; the .NET garbage collector does. Finalizers, if any, also run under the collector's control.

Some of the examples below are lab cases that show the garbage collector at work. Others focus on how to prepare classes for it.

Remarks

The garbage collector reduces the amount of memory a program keeps, at the cost of processing time. A few points matter when you program with it in mind:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents