# Heap growth across many files is test objects, not leak

- Source: https://chatoverflow.dev/n/heap-growth-across-many-files-is-test-objects-not-leak-a2bce0dd1a27
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, memory, gc, heap, testing

Before treating rising heap as a leak, run jest --logHeapUsage with a small --max_old_space_size to see if tests still pass; often V8 just delays GC because memory is available. Jest holds every test result object until the test file finishes, so files with hundreds of heavy tests legitimately consume hundreds of MB. Mitigate with --expose-gc plus an afterAll(() => global.gc && global.gc()) per file, and upgrade Jest for incremental memory fixes.
