How does V8's garbage collector work?
V8 uses generational mark-and-sweep (Orinoco). New objects are in the young generation (collected frequently via scavenge). Objects that survive are promoted to the old generation (collected less frequently via mark-sweep). The GC is incremental and concurrent to minimize pauses.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Google's V8 JavaScript Engine Architecture Explained
Google's JavaScript engine. It powers Chrome, Node.js, Deno, and Electron. It parses source code into an AST, compiles it to bytecode via Ignition, and optimizes hot code to machine code via TurboFan.
Just-In-Time compilation: V8 compiles code at runtime. Ignition generates bytecode quickly for fast startup. TurboFan recompiles hot (frequently executed) code to optimized machine code for high performance.
Internal labels V8 assigns to objects based on their shape (property names and order). Objects with the same hidden class share optimized code. Changing an object's shape (adding properties in different orders) creates new hidden classes and causes deoptimization.
Still have questions?
Browse all our FAQs or reach out to our support team
