-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
out of memory issue: garbage collection ? #2555
Comments
As reference https://github.com/mochajs/mocha/pull/2037/files#diff-b3b53682a18f203ac8d29b0e277cad26R749 Would it be possible that this handling should be done after each root describe block not only after a bunch of files which get threated as a single suite (as far as i can see) gets done ? So multiple describe blocks in multiple files should be the right way of testing this |
anyone ? |
bump :-) |
I'm not sure of the best way to diagnose memory leaks in Node (would love some assistance here), but otherwise I can't be of too much help without seeing your test(s). |
Thank you for the feedback. The problem is that as soon as the memory problems arise, a random test fails. Since we believe our test setup is in line with the common approach, there must be other teams that face these kind of memory problems? |
FWIW, I am running into a similar symptom, not sure if the cause is the same. I'm converting a nodeunit test suite to mocha. |
@TomVanHaver I've found out what is retaining memory in my particular case, sharing it here in case its something that might help you: Our application builds out a large graph object with nodes. In each of our tests, we build out a new graph. I found out that a few of these nodes were calling the js The direction of approach that finally got me here was this:
Hopefully that helps you track down your memory retainment. |
I'm going to close this; if someone can find a leak in Mocha itself, please create a new issue! |
Anyone encountering this should be aware of leakage to track down memory leaks in their code. |
i agree, but we are still looking how to track leaks in specs or to isolate suites. |
@TomVanHaver I might be missing something, but isn't this exactly what The following will throw if the spec is leaking. It does require you to actually modify the test code by wrapping the function, though, which is a bit of a pain (tool idea: use a codemod to dynamically create a version of your test suite where each test is wrapped in a
|
Recently we ran into out of memory issues (in node) when executing our tests via mocha.
We are running about 5000 tests/specs and are guessing it has something to do with closures and garbage collection.
For now we have logically splitted our runs into multiple ones, but it is just a matter of time before we encounter the same problems.
I am certain this issue will affect other teams also.
Can someone tell me how we can pinpoint/analyze/solve the problem?
Thank you very much in advance.
The text was updated successfully, but these errors were encountered: