over-allocation

Reserving more memory than is needed right now so that future growth does not require a copy every time.

In more detail

CPython over-allocates list storage, which is why sys.getsizeof reports a list's size jumping in steps as items are appended. The spare capacity is what makes append amortised constant time. The cost is some unused memory at any moment.

Related terms

Taught in

References