Interview practice question
Subtle Node.js memory leak from listeners
Backend Engineering · Language Runtimes · Experienced
Heap snapshots of your Node.js service show thousands of retained request objects referenced by closures attached to a shared EventEmitter. What is happening and how do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Listener added per request, never removed.
- Closure captures request → retained.
- MaxListenersExceededWarning hint.
- Remove listeners (off, once, AbortSignal).
- Avoid per-request subscriptions on long-lived emitters.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.