Skip to main content

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​

  1. Memory Safety ↔ of Programming Language to auto incl Garbage-Collection handling w/o need Imperative cleanup

  2. Heap Space ↔ V8 organize Heap into Page regions to work with Garbage Collector

  3. New-space ↔ Small Heap Space to contain most objects, independent of other Spaces, for fast Garbage-Collection

  4. Large-object-space ↔ Space to contain large objects above size limits of other Spaces. Each object assign mmap'd region of memory. Large objects never moved by Garbage Collector.

  5. Cell-space, property-cell-space and map-space ↔ Spaces to contain Cells, PropertyCells, and Maps, respectively. Each Space contains same sized objects with some constraints on type of objects to point to, to simplify Garbage-Collection.