Garbage-Collection
↔ 🧹Algorithm (in JS Engine) to remove old unused Object from Heap Memory
aka Garbage-Collected, Garbage-Collector, Memory-Safe
Memory Leak
​
old Values clogging up Heap; left behind, not removed
Garbage-Collection is implemented using a mark and sweep method
garbage collection automatically takes care of memory management and is one of the tools that makes JS a high-level language
References​
Memory Safety
↔ of Programming Language to auto incl Garbage-Collection handling w/o need Imperative cleanupHeap Space
↔ V8 organize Heap into Page regions to work with Garbage CollectorNew-space
↔ Small Heap Space to contain most objects, independent of other Spaces, for fast Garbage-CollectionLarge-object-space
↔ Space to contain large objects above size limits of other Spaces. Each object assignmmap
'd region of memory. Large objects never moved by Garbage Collector.Cell-space, property-cell-space and map-space
↔ Spaces to containCell
s,PropertyCell
s, andMap
s, respectively. Each Space contains same sized objects with some constraints on type of objects to point to, to simplify Garbage-Collection.