Ctrl K
Python · Senior · Theory

How does memory management work in CPython? And how would you track down a memory leak in a long-running Python process?

~4 min by voice

How to approach it

The interviewer checks whether you understand CPython's actual memory model (reference counting plus a generational GC for cycles) and whether you can hunt down leaks in production systematically, with tools and a method, instead of just restarting the process.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsВаш процесс на сервере с 16 гигабайтами памяти показывает в top VIRT 40 гигабайт, RES 2 гигабайта, а потом его внезапно убивает OOM killer. Объясните, как устроена память процесса в Linux, что означают эти цифры и как процесс мог дойти до OOM. Mid-levelA service running on G1 periodically has pauses of one to two seconds, and it's hurting latency. What would you do, and when is it worth looking at a different garbage collector? Mid-levelOver a day of running, a Python worker grows in memory from two hundred megabytes to three gigabytes. How would you track down the leak? Mid-levelYou have a Java service with a 30 GB heap, and the business is complaining about long pauses. How would you choose and tune the garbage collector? SeniorWhat is the garbage collector in Java, and how does it figure out which objects can be removed? Junior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min