Code Room
On-callHardoc-g180
Subject Memory leakLevel Senior–Staff~40 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A Node.js WebSocket fan-out service's RSS grows ~150MB/hour and the process is recycled by the orchestrator every ~10 hours when it hits 4GB, dropping all live connections at recycle. Heap dashboards from `process.memoryUsage()` show heapUsed climbing slowly but most of the growth is in 'external' and RSS, not heapUsed. GC runs frequently and reclaims little. A v8 heap snapshot taken 2 hours apart shows the retained-size delta dominated by 'system / Context' and a Map keyed by socket id whose size only ever grows. A feature shipped last week added per-connection metrics buffering. Sessions per day are flat. Triage and fix this.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

Diagram & narrate the incident
Loading whiteboard…
Run or narrate your approach, then ask the coach.