In a garbage-collected language, what causes a memory leak?
Leak in managed languages: the GC only frees unreachable objects. If you keep a reference (in a cache, static field, or listener), the object stays reachable and is never collected, growing memory over time.
2 / 5
What is a heap dump used for?
Heap dump: a snapshot of the heap showing every live object, its size, and reference chains. Tools analyze it to find which objects dominate memory and what is keeping them alive (the GC root path).
3 / 5
A classic JavaScript leak is failing to remove what?
Listener leak: attaching a listener that closes over a DOM node and never calling removeEventListener keeps the node and its closure alive even after it is removed from the document, leaking memory.
4 / 5
What does a dominator tree show in a heap analysis?
Dominator tree: object A dominates B if every path from a GC root to B passes through A. The retained size of A is all memory freed when A is gone, helping pinpoint the true owner of leaked memory.
5 / 5
Why is a steadily climbing memory graph that never drops after GC a red flag?
Sawtooth vs climb: healthy memory usage shows a sawtooth (rises then drops at GC). A baseline that climbs after each collection indicates retained objects accumulating - the signature of a leak.