SpiderMonkey Garbage Collector
6 months ago
- #JavaScript
- #Garbage Collection
- #SpiderMonkey
- SpiderMonkey garbage collector manages memory allocation and deallocation for JavaScript data structures.
- It is a hybrid tracing collector with precise, incremental, generational, concurrent, parallel, and compacting features.
- Precise collection avoids conservative techniques by knowing the layout of allocations and stack roots.
- Incremental collection reduces user impact by breaking execution into small slices.
- Generational collection separates allocations into nursery (young) and tenured (old) heaps for efficiency.
- Concurrent collection offloads some GC work to other CPU cores.
- Parallel collection performs work within GC slices in parallel.
- Compacting collection reduces external fragmentation by moving allocations between arenas.
- Partitioned heap uses 'zones' for independent collection and incremental compaction.
- More details can be found in the [SMDOC] Garbage Collector comment in the sources.