Skip to content

Commit 3afaf3c

Browse files
test(jest): recycle workers above 512MB to bound vm-context module registry growth (#3550)
Adds `workerIdleMemoryLimit: '512MB'` to jest.config.js. Jest forks worker child processes that accumulate per-suite vm-context module registry under `--experimental-vm-modules` (~14 MB retained per loaded suite). On large downstream test suites this leaks until the worker OOMs. The flag tells jest to inspect each worker's RSS between suites and respawn when it exceeds the threshold. Respawn cost (~150-300 ms) is negligible vs. the OOM crash it avoids on long-running coverage runs. This complements PR #3549 (migration pre-warm) which addressed migration overhead but not the vm-context module registry growth.
1 parent eae9410 commit 3afaf3c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,11 @@ export default {
221221

222222
// Whether to use watchman for file crawling
223223
// watchman: true,
224+
225+
// Recycle worker child processes when their RSS exceeds this threshold.
226+
// Counters jest's per-vm-context module registry accumulation (~14 MB
227+
// retained per loaded suite under --experimental-vm-modules) which would
228+
// otherwise OOM long-lived workers on large downstream test suites.
229+
// The respawn cost (~150-300 ms) is negligible vs. the OOM crash it avoids.
230+
workerIdleMemoryLimit: '512MB',
224231
};

0 commit comments

Comments
 (0)