Structure of a heap

A heap consists of two lists of cells; the list of allocated cells and the list of free cells.

A heap simply consists of two lists of cells; one is the list of allocated cells and the other the list of free cells. Each list is anchored in the heap object.

A cell consists of a cell header followed by the body of the cell itself. The body of the cell is the area of memory which is considered allocated.

The cell header is a struct of type RHeap::SCell defined as part of the RHeap class in e32std.h.

The following diagram shows a typical mix of free and allocated cells.

Figure 1. Example of the allocated and free cells in a heap