Two memory leak stories in the story of flipkart.com
summary
Two real bugs at Flipkart: a fetch-cancellation pattern using promise.race + timer not cleared leaves full response objects reachable and causes an out‑of‑memory crash under a sudden ~100k RPS spike (process dies in ~4s); fix: clear the timeout (or use AbortController) so the fetch reference drops. The other is a module‑scope array that accumulates 65,000 CSS chunk strings over weeks, slowly blocking the event loop and raising latency; fix: dedupe with a Set or check before push. Diagnosis uses Chrome DevTools heap snapshots via node inspect.
AI-written summary · about
chapters (10)
- 0:00Introduction to memory leaks
- 3:09Load testing and spike failures
- 5:57Understanding memory growth
- 9:31Debugging with heap snapshots
- 14:02First leak: Uncleared timeouts
- 16:26Performance testing process
- 18:33Unexplained latency increase
- 21:02Second leak: CSS chunks array
- 24:10Fixes and long-term impact
- 26:15Conclusion and tools gratitude
related talks
06mYour app crashes my browser
36mThe Memory Leak Brain Drain – Workshop
24mDemystifying Memory Leaks in JavaScript
18mYour App Crashes My Browser
20mMemory Leaks and the Havoc They Wreak
19mUnderstand, find, prevent and fix memory leaks in JavaScript
31mMemory Leaks in JavaScript
23mWarp Speed Memory Management
