seniorNode.js
V8 Garbage Collection: Scavenge vs Mark-Sweep
Updated May 4, 2026
Short answer
V8 uses a generational GC: 'Scavenge' (Minor GC) for short-lived objects in New Space, and 'Mark-Sweep/Compact' (Major GC) for long-lived objects in Old Space.
Deep explanation
Most objects die in New Space. V8 uses the Cheney algorithm to copy survivors. If an object survives multiple Minor GCs, it's promoted to Old Space. Major GC marks reachable objects, sweeps dead ones, and compacts memory.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro