Why a Managed Heap?

 Managed Heap.

The .NET framework includes a managed heap that all .NET languages use when allocating reference type objects. Lightweight objects known as value types are always allocated on the stack, but all instances of classes and arrays are created from a pool of memory known as the managed heap.

The basic algorithm used by the garbage collector is quite simple:

·                 Mark all managed memory as garbage

·                 Look for used memory blocks, and mark them as valid

·                 Discard all unused memory blocks

·                 Compact the heap