-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Memory Leak] on module loading #6738
Comments
test with module fast-glob ✔️result with node fs & fast-glob$ node --expose-gc ./node_modules/jest/bin/jest --runInBand --no-cache --logHeapUsage
PASS __tests__/leak.test.js (1).js (43 MB heap size)
PASS __tests__/leak.test.js (11).js (43 MB heap size)
PASS __tests__/leak.test.js (2).js (43 MB heap size)
PASS __tests__/leak.test.js (3).js (43 MB heap size)
PASS __tests__/leak.test.js (10).js (46 MB heap size)
PASS __tests__/leak.test.js (5).js (43 MB heap size)
PASS __tests__/leak.test.js (7).js (43 MB heap size)
PASS __tests__/leak.test.js (6).js (43 MB heap size)
PASS __tests__/leak.test.js (9).js (43 MB heap size)
PASS __tests__/leak.test.js (8).js (43 MB heap size)
PASS __tests__/leak.test.js (4).js (46 MB heap size)
Test Suites: 11 passed, 11 total
Tests: 11 passed, 11 total
Snapshots: 0 total
Time: 5.47s
Ran all test suites.
Done in 6.42s. |
Wow, sounds bad! Any update/progress on that? We noticed that in our project where we have ~50 test files, it started to fail in CircleCI because of memory usage. We use |
@kirillgroshkov workaround for your issue is: change fs-extra to fs-jetpack |
Well, I'm not that easy on just changing dependencies that we use in many projects extensively ( Interesting that we use |
Yes, fs-extra is not leaky. It declare global stuff and every test in jest will declare it again and that leaks. Fs-jetpack don't do that. If u find a solution to cleanup up the global stuff, let me know. |
@kirillgroshkov here u see the result of node fs native. But we need fs async - so we use fs-jetpack. Checkout #6814 |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
From what I can tell, this is an issue with those modules, not Jest. Or, Jest probably exposes/excarebates/creates the condition for them to leak, but still. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
Jest no longer releases memory for specific modules - e.g. fs-extra | graceful-fs | archiver
To Reproduce
make a testcase which loads one of the moduls and repeat that. so u can see the heapusage increase or u use my repo for that
Expected behavior
memory decrease after testcase
Link to repo
Testcases to reproduce Memory Leak easily include documented test results.
Test Result of my repo
✔️result without one of "leaky" moduls.
❌result with fs-extra
❌result with graceful-fs
❌result with node fs & archiver
The text was updated successfully, but these errors were encountered: