Interactive

Memory, visualized

The whole reason C-lingua exists is that these languages make you think about memory. So here it is, moving: watch struct padding appear and vanish as you reorder fields, step a heap block through malloc to free to a use-after-free that lights up red, and see the call stack grow, shrink, and dangle. All computed in your browser, no code executed.

struct fields (drag order with the arrows)

add:
0
sizeof
0
data bytes
0
wasted (padding)
0
alignof
padding (wasted) Each cell is one byte. Reorder fields largest-first to squeeze the holes out.