How Python Frees Memory
Talk it through out loud with your AI coach.
The problem
- easy
- Pro
A developer coming from C asks how Python knows when to free an object's memory, and whether the del statement deletes an object. Explain how CPython manages memory for everyday objects.
What a strong answer covers
- The bookkeeping CPython keeps on every object.
- The moment an object's memory is given back.
- What deleting a name really does.
- Why resource clean-up shouldn't depend on this mechanism.
Common mistake: Saying del destroys the object, when it only removes one reference to it.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud