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

EventEmitter memory leak #133

Closed
roymiloh opened this issue Jun 22, 2016 · 2 comments
Closed

EventEmitter memory leak #133

roymiloh opened this issue Jun 22, 2016 · 2 comments

Comments

@roymiloh
Copy link

This error appears whenever I use gulp-mocha with a watcher (memory increases per mocha.run), with mocha's cli (mocha --watch) it does not seem to reproduce.

I've tried the current pull requests - it's still happing. The cli itself handles watch a slightly different, haven't checked; anyway, it looks like a critical bug.

An example could be any suit case, it just increases as mocha.run() is called. Any ideas?

@roymiloh
Copy link
Author

roymiloh commented Jun 26, 2016

Well, it was smth with babel's require hook, which I pass as a plugin to mocha mocha({ require: ['babel-register'] }), I may imagine why it didn't work; would you consider it as a bug?

Anyway, the memory still increases, but less then before. I've checked with mocha --watch and it increases as well, but less then the current gulp-mocha plugin, for any reason.

It looks like it's smth with require.cache, no matter if require.cache length is the same after running the tests, the heap keeps growing. A reference nodejs/node-v0.x-archive#6176.

UPDATE:
After further investigation, as it looks now, it deletes redundant files from the cache. Mocha deletes files it watches, which are the specs themselves and some other src files in the "current working module". However, this looks "slightly" different (:flushed:), which makes the heap (extremely) growing up because delete require.cache[...] doesn't really freeing things, as referenced before.

We can ignore files from node_modules from being deleted and it will work fine.

@Jameskmonger, wdyt?

@sindresorhus
Copy link
Owner

Should be fixed in the latest release: https://github.com/sindresorhus/gulp-mocha/releases/tag/v4.0.0

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

2 participants