Memory · interview question
Which option is the safer default when shipping code around tracing allocations?
Multiple choiceHardchapter-16-curatedpremiummemorytracing-allocations
import tracemalloc
tracemalloc.start()
snapshot = tracemalloc.take_snapshot()
print(snapshot.statistics("lineno")[:3])Answer and explanation
Correct answer
D. Choose the simpler shape that keeps the rule obvious, validated, and easy to observe in logs or tests.
Why
The safest default is usually the one that lowers ambiguity and makes errors easier to diagnose.
Test yourself on Memory
A free test with instant, explained results. No account needed.
More Memory questions
- What kind of contract clarity matters most for tracing allocations?
- Which explanation would best help the team align on long-lived objects?
- A bug appears around long-lived objects. What is the strongest first debugging move?
- Which option treats tracing allocations as an engineering policy decision instead of a syntax trick?
- If long-lived objects fails in production, what handling philosophy is strongest?
- What production risk should you worry about most if long-lived objects is handled lazily?