2/34
Part 1 of 7 · alloc and freeLearn and do

An allocator hands out runs of memory and takes them back

Start with what an allocator does, on an arena small enough to draw.

Predict

An arena of 10 units. alloc(3), alloc(4) and alloc(2) all succeed. Then alloc(2) again: what comes back?

Pick an answer above to see the rest
Predict

An arena of 7: A holds units 0 to 2, B unit 3, C units 4 to 6. Free A and C. Can alloc(4) succeed?

Pick an answer above to see the rest