Web Vitals & Performance (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Profiling Frontend Memory Leaks in Chrome DevTools.
senior LevelPerformanceMemory ManagementSystem Design
In Simple Words: Memory leaks cause browser tabs to consume gigabytes of RAM, triggering garbage collection thrashing that cripples INP:
- Three Snapshot Technique:
- Take Heap Snapshot 1.
- Perform action (e.g. Open & Close Modal).
- Take Heap Snapshot 2.
- Perform action again.
- Take Heap Snapshot 3.
- In Snapshot 3, filter by Objects allocated between Snapshot 1 and 2.
- Inspect Retaining Tree to find references preventing GC (e.g. uncleared intervals, unremoved global event listeners, detached DOM nodes).