-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Version
30.0.0-beta.9
Steps to reproduce
Repeat the following using 30.0.0-beta.5 and 30.0.0-beta.6:
- Unzip this example repo: test.zip
- Install with your preferred package manager.
- Start monitoring system memory usage, then run
jest
.
Expected behavior
Memory usage is about the same between 30.0.0-beta.5 and 30.0.0-beta.6.
Actual behavior
With 30.0.0-beta.5, free memory decreases from 19G to 18G. Tests take about 5 seconds wall clock time.
With 30.0.0-beta.6, free memory decreases from 19G to 9.2G. Tests take about 7 seconds wall clock time.
Additional context
My system I used for testing has 32G memory and 16 CPU cores, which seems to mean Jest runs 10 child processes for the 10 test files included in the example repo.
The setTimeout
in the tests is not necessary to reproduce, it's just there to make it easier to get memory measurements. It also continues to reproduce if the async
is removed along with the awaited promise.
The require of the @wordpress/components
package seems to be what's somehow bringing the memory usage way up. I don't know whether other large packages might do the same thing.
Attempting to measure memory usage within node (e.g. with node --inspect-brk
) does not seem to reflect the increased memory usage. Or maybe I was just doing it wrong.
Using --runInBand
shows a more modest effect: memory usage is still up in beta.6 compared to beta.5, but since it's doing one test at a time it doesn't go up as obviously as it does with 10 workers.
Environment
System:
OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon 780M Graphics
Binaries:
Node: 22.16.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.2 - /usr/bin/npm
pnpm: 10.11.1 - /usr/local/bin/pnpm
npmPackages:
jest: 30.0.0-beta.6 => 30.0.0-beta.6