-
-
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 when using --coverage flag #3292
Comments
cc @bcoe |
I can repro it with the Jest repo, although I get a similar behavior without With coverage
Without coverage
|
Can confirm this behaviour on Jest repo, although it doesn't happen on thousands of tests suite like that: describe('test', function() {
beforeAll(function() {
global.gc();
});
it('work', function() {
expect(1).toBe(1);
});
}); |
@thymikee so you suggest that calling |
@danieljuhl @thymikee very curious about whether the @addaleax have you bumped into anything like this with Node's test suite? |
I use |
Calling |
@thymikee @rogeliog @danieljuhl if we can get a fairly minimal reproduction, ideally exhibiting a minimal leak without coverage, and a leak with coverage, I'll happily use heapdump to do some investigating. |
I'll try to make a small repro, but probably won't have the time before Tuesday. |
@danieljuhl any updates? Can you also try if it happens on Jest 20? |
I am facing the same problem, but the issue seems isolated to our CI environment. OP referenced this being unusable in CI, so I thought this might be helpful https://discuss.circleci.com/t/memory-problems-with-jest-and-workers/10297 Obviously, if the issue exists in a local dev environment, then there is a larger memory issue. But thought this might be helpful. |
Having the same issue with jest in Travis-CI, anyone have a workaround or a fix ? Might have to revert jest versions to bring things back in line. @thymikee . Right now on Jest Note I have around 883 tests running right now, which doesnt seem like alot consider the gents at Facebook are well into the thousands. |
Alright I was able to solve this(although not an ideal workaround) with this command: Notice the Reference thread that helped: EDIT: Still having this issue, going to go down the route of closing the window right after |
Okay solved the memory leak by removing any reference to jsdom.jsdom('') as part of my test suite. I am actually not using it at the moment so it's not a big issue, but if anyone is having this this might help. |
@thymikee yep thanks! Your comment in that issue is exactly what led to my solution. I first closed the window object and things started working, then I thought to myself, "do I really need jsdom with my current test suite?" and then removed it altogether. Thanks for the help!! |
@danieljuhl any news on the repro? |
We are reducing memory for coverage in Jest 21 ( |
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
What is the current behavior?
When running our test suites with
--coverage
memory seems to leak, and heap size increases with ~13MB per test suite (we have a total of 240 test suites), ultimately causing Jest to slow down (as mentioned in other memory leak issues)If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.Unfortunately we can't provide the actual code from our tests, but all we have to do is enable
--coverage
to get the above behavior.What is the expected behavior?
We would expect some overhead, but 13MB per test suite is causing our CI to timeout and make the coverage flag unusable.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
node@6.9.4
,yarn@0.19.1
,jest@19.1.0-alpha-eed82034
, Mac OSX v10.12.3I've masked the real path... so this is actually different files:
node --expose-gc $(BIN)/jest --no-cache --i --logHeapUsage
node --expose-gc $(BIN)/jest --coverage --no-cache --i --logHeapUsage
The text was updated successfully, but these errors were encountered: