1/14
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the core concept V8 uses to determine if memory can be freed?
Reachability; meaning objects that cannot be reached from the Root are considered garbage
What are the two primary generations in the V8 Heap structure?
The Young Generation (New Space) and the Old Generation (Old Space)
Which algorithm is used for Major Garbage Collection in the Old Space?
Mark-Sweep-Compact
What is the name of the algorithm used for Minor GC in the Young Generation?
Scavenge (using the Cheney algorithm)
What defines a "Root" in JavaScript memory management?
Global objects; local variables in the current stack frame; and internal V8 handles
What happens to an object in the Young Generation if it survives two Scavenge cycles?
It is promoted (tenured) to the Old Generation
What is a "Stop-the-World" event in Garbage Collection?
A pause where the main program execution halts completely so the Collector can process memory safely
How does Incremental Marking improve application performance?
It breaks the marking phase into small chunks interleaved with JavaScript execution to avoid long pauses
What is a memory leak?
When objects are no longer needed by the application but are still referenced by the Root; preventing GC from removing them
Which Node.js flag is used to increase the heap size limit for the Old Generation?
--max-old-space-size
What is the special behavior of WeakMap keys regarding Garbage Collection?
The keys are weakly referenced; allowing them to be garbage collected if no other strong references exist
What are the three distinct phases of a Major GC cycle?
Marking (identifying live objects); Sweeping (freeing dead memory); and Compacting (defragmenting)
Why is the Young Generation kept small (typically 1-8MB)?
Because most objects die very quickly ("The Generational Hypothesis"); making a small space efficient for frequent cleanup
What role does the "Write Barrier" play in GC?
It records references from the Old Generation to the Young Generation so the Scavenger doesn't have to scan the entire Old Heap
Which tool is most commonly used to debug memory leaks in Node.js?
Heap Snapshots (via Chrome DevTools or the v8-profiler)