Skip to content
Sharp

Memory · interview question

A bug appears around long-lived objects. What is the strongest first debugging move?

Multiple choiceHardchapter-16-curatedpremiummemorylong-lived-objects
python
cache = []
for row in rows:
    cache.append(row)  # keeps every row alive for the whole process
Choose one answer
Answer and explanation

Correct answer

B. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. If everything is kept 'just in case', memory usage becomes a design problem rather than a garbage collector problem.

Test yourself on Memory

A free test with instant, explained results. No account needed.

Start free test
All Memory questions →