Caution: Educational Tool

JS Memory Leak Simulator

Intentionally trigger and study common JavaScript memory leaks. Open Chrome DevTools (Memory tab) to take heap snapshots.

Live Heap Graph

Recording...

Note: Real-time JS heap data requires Chrome/Edge (`performance.memory`). Other browsers may show simulated data.

Detached DOM Nodes

i
Why it leaks: Creating DOM elements but saving them in a JS array while removing them from the visible document prevents the Garbage Collector from freeing them, as your array still holds the references.

Generate 10,000 hidden `div` elements assigned to a global array.

Closure Scope Retention

i
Why it leaks: A function closure keeps references to outer scope variables. If the closure is stored globally and repeatedly reassigned in a chain, the entire chain of massive strings/objects is kept alive.

Re-assign a global closure that traps a massive 1MB string in its context.

Uncleared Intervals

i
Why it leaks: An active `setInterval` keeps its callback alive. If the callback references heavy objects or DOM nodes, they can never be garbage collected until `clearInterval` is called.

Start a heavy recurring task storing random data arrays globally without ever clearing the interval.