Skip to content
Preptima
mediumConceptCodingMidSeniorStaff

A list of a million small objects uses far more memory than the data inside them. Where is it going?

5 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

Into per-object overhead: in CPython on a 64-bit build every object carries a 16-byte header, every field is itself a boxed object reached through an 8-byte pointer, and each instance has a dictionary.

Was this answer helpful?

Likely follow-ups

  • Why does a dataclass with slots enabled behave differently from one without when you assign an unexpected attribute?
  • How would you measure the true size of a nested structure, given that getsizeof does not recurse?
  • What does a list do with its capacity as it grows, and how does that show up in memory?
  • When is a single NumPy structured array the wrong answer despite being the smallest one?

Related questions

Further reading

Related Topics