The Growth Factor Debate: 1.5x, 2x, or Something Else?

Post 3 of the Dynamic Arrays in C series · Full source code on GitHub The Choice We Skipped In Post 2, we solved the “array is full” problem by doubling the capacity on every realloc. We wrote new_cap = old_cap * 2, watched the buffer grow from 2 to 4 to 8 to 16, and moved on. Three reallocations for 12 elementsm, pretty good. But we never justified the number 2. Why not 1.5? Why not 3? Why not just add 100 slots every time? ...

June 1, 2026 · 17 min · pablo

Growing Pains: realloc and Automatic Capacity Management

Post 2 of the Dynamic Arrays in C series · Full source code Where We Left Off In Post 1 we built an array that does three things: allocate a fixed buffer, push integers into it, and free everything when we’re done. It works, until it doesn’t. The moment the user pushes one element more than the initial capacity allows, array_push returns -1 and refuses to cooperate. The array is full and there’s nothing we can do about it. ...

May 28, 2026 · 14 min · pablo