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

Eliminate memory leak in logger for jest #399

Conversation

ertrzyiks
Copy link
Contributor

@ertrzyiks ertrzyiks commented Dec 14, 2019

Related to #397

.pipe() call attaches events listeners to the writeable stream
which in case of stdout and sequential jest tests causes memory
leak as those listeners are added for every test file.

Since stdout stream is special, for example it never ends while
the process is runing, we can use simplified piping by
listening to the data event of the readable stream and
redirect data to stdout. This way no listeners are leaking.

@ertrzyiks ertrzyiks force-pushed the eliminate-memory-leak-from-logger-for-jest branch 3 times, most recently from e4a2682 to a904dcb Compare December 14, 2019 18:59
`.pipe()` call attaches events listeners to the writeable stream
which in case of stdout and sequential jest tests causes memory
leak as those listeners are added for every test file.

Since stdout stream is special, for example it never ends while
the process is runing, we can use simplified piping by
listening to the `data` event of the readable stream and
redirect data to stdout. This way no listeners are leaking.
@ertrzyiks ertrzyiks force-pushed the eliminate-memory-leak-from-logger-for-jest branch from a904dcb to 8489bb0 Compare December 14, 2019 19:02
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 95.153% when pulling 8489bb0 on ertrzyiks:eliminate-memory-leak-from-logger-for-jest into 6206c61 on pact-foundation:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 95.153% when pulling 8489bb0 on ertrzyiks:eliminate-memory-leak-from-logger-for-jest into 6206c61 on pact-foundation:master.

@ertrzyiks ertrzyiks marked this pull request as ready for review December 14, 2019 19:17
@mefellows
Copy link
Member

Thanks @ertrzyiks, this looks good. When I get a moment I'll have a closer look and bring it in if no issues. Much appreciated.

@TimothyJones
Copy link
Contributor

Looks good to me! Thanks very much!

@TimothyJones
Copy link
Contributor

Ah, I tried this out using npm link on an old repository that had an event emitter warning (this one), but the warning persisted. I'm afraid I don't have time to look in to it in more detail at the moment, and it's possible I missed something when I set up the link (or pact - it's from a while ago).

@stale
Copy link

stale bot commented Jan 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@mefellows
Copy link
Member

Closing until somebody can pick it back up again.

@mefellows mefellows closed this Apr 19, 2020
@ertrzyiks ertrzyiks deleted the eliminate-memory-leak-from-logger-for-jest branch April 20, 2020 07:51
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

Successfully merging this pull request may close these issues.

None yet

4 participants