Memory Leak
A memory leak is memory a program has allocated but cannot reclaim (still referenced yet no longer used), causing memory to grow continuously.
Purpose
Identify and fix memory leaks, preventing long-running processes from OOM.
Mechanism
Common causes: accidental globals, uncleared timers/listeners, closures capturing large objects, ever-growing Map/Set. Compare Chrome DevTools Heap Snapshots to locate leaks. Weak references (WeakMap/WeakRef) prevent them.
Use cases
- Performance diagnosis
- Long-run stability
- Memory optimization