NET Generational Garbage Collection (GC) Deep Dive
1 min readRapid overview
Generational Garbage Collection (JavaScript)
JavaScript engines use generational GC to optimize for short-lived objects.
Generations
- Young space: New allocations, collected frequently.
- Old space: Promoted objects that survive collections.
Why it matters
- Excess allocations in render loops increase GC pressure.
- Long-lived caches grow old space and cause longer pauses.
Practical guidance
- Reuse objects in hot loops.
- Avoid holding large arrays in global state without limits.
- Clear timers and listeners when components unmount.
Interview prompt
- Explain how you reduce GC pressure in UI rendering.