From the course: C# and .NET Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

.NET garbage collection

.NET garbage collection - C# Tutorial

From the course: C# and .NET Essential Training

.NET garbage collection

- [Instructor] The .NET platform uses what's called a Managed Memory Model similar to other platforms like Java. In other words, the platform takes care of managing the blocks of memory that your program creates and reclaiming them when they are no longer in use. The garbage collection also works to make sure that when your program allocates memory for use that memory is created efficiently within the managed heap for your program. The heap is an area of system memory reserved for your program where your program's objects are kept safe from other programs and processes. So all of this happens automatically. This frees the developer from having to manually keep track of allocations and then remembering to dispose of each one. So, there are a few exceptions to this process and usually these are associated with operating system resources, like files and network connections that your program needs to explicitly clean up on its…

Contents