Forcing Garbage Collection
1 min readRapid overview
Forcing Garbage Collection (JavaScript)
In production JavaScript, you generally do not force GC. Let the engine manage it.
Notes
- Forcing GC can cause UI jank and unpredictable pauses.
- In browsers, manual GC is not exposed.
- In Node.js,
--expose-gcexists for testing, not production.
Interview prompt
- Why is forcing GC a bad idea in UI apps?