V8 Engine (Node.js)
V8 is Google's open-source JavaScript engine, written in C++, that Node.js uses to execute your code. It compiles JavaScript to fast machine code with just-in-time compilation and manages memory with garbage collection.
Node.js
V8 is the same engine that powers JavaScript in Chrome. It parses your JavaScript, compiles it to native machine code (rather than interpreting it line by line), and continually re-optimizes hot code paths, which is why Node is fast for a dynamic language.
V8 handles memory automatically through garbage collection, freeing objects you no longer reference. This is convenient but means you should understand its limits: by default V8 caps heap size (often around 1.5-4 GB depending on version/flags), and you can raise it with --max-old-space-size for memory-heavy programs.
Node bridges V8 to the operating system: V8 runs the JavaScript, while libuv and Node's C++ bindings provide the I/O, timers, and OS access that the browser would otherwise supply. Some Node features (like BigInt or new syntax) depend on the bundled V8 version.
Syntax
node --max-old-space-size=4096 app.jsExamples
JavaScript
// V8 exposes memory usage through Node
const { heapUsed } = process.memoryUsage();
console.log("Heap used (MB):", Math.round(heapUsed / 1024 / 1024));