How does garbage collection work in Node.js V8 and what are the two main heap regions?

Node.js Developer Hard

Node.js Developer — Hard

How does garbage collection work in Node.js V8 and what are the two main heap regions?

Key points

  • V8's garbage collector separates objects based on their lifespan
  • Young Generation is for short-lived objects collected with Scavenge
  • Old Generation is for long-lived objects collected with Mark-Sweep/Mark-Compact
  • Efficient memory management in Node.js

Ready to go further?

Related questions