.NET Runtime Memory Management
In this module, you will learn how memory works inside a .NET application by taking a detailed look at both stack memory and heap memory. You will see how the stack stores method parameters, return addresses, and local variables in stack frames that are automatically cleaned up the moment a method exits, and why careless use of recursion can lead to a stack overflow exception.
You will then explore the heap, where all reference types and objects created with the new keyword live, and you will see exactly how the stack and heap work together.
Lesson Preview
This lesson explains the .NET linear memory layout where the stack and heap grow toward each other, and details how a new stack frame is pushed for every method call to store its parameters, return address, and local variables.