Skip to content
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 mathjs in jest tests #1592

Closed
sublayerio opened this issue Aug 14, 2019 · 7 comments
Closed

Memory leak when using mathjs in jest tests #1592

sublayerio opened this issue Aug 14, 2019 · 7 comments

Comments

@sublayerio
Copy link

I noticed unexpected behaviour when using mathjs in Jest.

I created 16 test files that just import mathjs.

Screenshot 2019-08-14 at 14 39 34

When running the tests the memory heap piles up.

Screenshot 2019-08-14 at 14 38 46

@josdejong
Copy link
Owner

Thanks for reporting Olivier.

At first sight I have no clue what could cause this. Since const mathjs = require('mathjs') is "passive", I doubt whether mathjs itself can instantiate "something" multiple times, nothing is invoked. Is it really mathjs related, or does it occur too with other libraries? As far as I know, inside a single nodejs process, a require is only loaded once. Can it be that Jest does open multiple processes in parallel or so?

@harrysarson
Copy link
Collaborator

Can this be reproduced without using Jest?

@harrysarson
Copy link
Collaborator

Could Jest run each js file in a separate process (or something)? If so then it would make sense for memory usage to increase.

@sublayerio
Copy link
Author

sublayerio commented Aug 15, 2019

Thanks for your replies.

I think it has to do with running things in parallel and things not getting cleaned up after tests have run. I opened an issue at jest repo as well to figure that out.

jestjs/jest#8832

@josdejong
Copy link
Owner

Yeah something like that makes sense. It could be that there is no actual problem though and that the garbage collector simply didn't trigger yet.

@gwhitney
Copy link
Collaborator

gwhitney commented Oct 6, 2023

Is there still an issue here four years later, or can this be closed?

@josdejong
Copy link
Owner

Let's assume it is resolved and close this issue. Please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants