How do you identify and resolve memory leaks through performance testing?
- memory leaks
- soak testing
- profiling
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Detection: (1) Soak test: run steady load for 4-24 hours, monitor memory usage trends. (2) A consistent upward trend in memory without corresponding load increase indicates a leak. (3) Monitor garbage collection frequency and duration. Resolution: (4) Use profiling tools (Node.js heap snapshots, Chrome DevTools, Java VisualVM). (5) Compare heap snapshots at intervals to find growing objects. (6) Common causes: unclosed connections, event listener accumulation, growing caches without eviction, global variables. (7) After fix, re-run soak test to verify memory is stable.
What interviewers listen for
- Workload modellingYou design the load shape from product traffic, not from tool defaults.
- Percentile literacyYou read p50/p95/p99 separately and explain why each matters.
- Bottleneck triageYou correlate metrics across application, database, and infrastructure layers.
- Capacity instinctsYou can translate a soak test into a sizing or scaling recommendation.