Interview practice question
Holding millions of objects in Python uses too much memory
Backend Engineering · Language Runtimes · Intermediate
Your Python service loads 10 million small records into memory as dictionaries and uses 8 GB of RAM. How can you reduce memory?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Dicts have large per-object overhead.
- Use __slots__ classes or tuples/namedtuples.
- Columnar storage: arrays, NumPy, pandas, Arrow.
- Load only needed fields.
- Consider external store (DB, Redis).
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.