Q33: How does Memory Management and Garbage Collection work in V8?
JavaScript automatically manages memory using Mark-and-Sweep garbage collection algorithm. Roots (global variables, call stack references) are traversed. Any allocated memory object unreachable from roots during mark phase is swept and freed.
Key Takeaways
V8 uses Mark-and-Sweep garbage collection algorithm.
Unreachable objects disconnected from root scope are marked for memory deallocation.
Knowledge Check
What memory condition causes an object to be reclaimed during garbage collection?