-
-
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
jests async wrapper leaks memory #8984
Comments
I wonder if it also happens with jest-circus? https://github.com/facebook/jest/tree/master/packages/jest-circus |
Haven’t tried it yet, will do so tomorrow. Lets see how easy it is to integrate… We have a quite complex setup, also browsing through the issues, I’m not sure how production ready it already is? |
It is production ready, but has differences from jasmine |
Just tried |
The circus memory issue is tracked here: #8816. |
If this is still an issue using the latest version of Jest (27 at the time of writing), please provide a reproduction we can pull down and test. The leak mentioned above has been fixed 🙂 |
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
Possibly related to: #6814 and other reports of memory leaks…
I do have quite severe memory leaks, because one of our modules is super big (it imports a translation dictionary in multiple languages).
Each test file which imports that module blows up jests memory usage by ~20M.
While debugging the memory leak, I noticed that the translation dictionary is kept alive through jests
asyncJestTest
, which holds onto the closurefn
.I tried just unsetting
fn
after calling it, which worked for theasyncJestTest
, but was failing forasyncJestLifecycle
for some reason.Oh, I get it… most likely because those lifecycles are called multiple times, haha.
To Reproduce
Steps to reproduce the behavior:
Use async functions for tests and lifecycle hooks that reference large objects :-)
Expected behavior
Jest should not leak! It should clean up all the async functions properly when a test file is finished.
Link to repl or repo (highly encouraged)
envinfo
The text was updated successfully, but these errors were encountered: