Heap (Memory)

A heap is a data structure for managing memory that allows segments of memory to be allocated and freed for reuse at arbitrary times.

Don’t use Heap if you can use the Stack.

Warning

Don’t confuse with Heap data structure.

A wide misconception is that heap allocation is a primitive operation, such as arithmetic or loads and stores to memory. In fact, they are calls to intricate algorithms that manage interesting Data Structures.

How is the heap implemented?