JavaScript Internals: Garbage Collection
Garbage collection (GC) is a very important process for all programming languages, whether it’s done manually (in low-level languages like C), or automatically. The curious thing is that most of us barely stop to think about how JavaScript — which is a programming language, and hence, needs to GC — does the trick. Like the majority of high-level languages, JavaScript allocates its objects and values to memory and releases them when they’re no longer needed. But, how?