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 caused by Gulpfile's nodemon task. #32

Open
metaColin opened this issue Oct 7, 2015 · 0 comments
Open

Memory leak caused by Gulpfile's nodemon task. #32

metaColin opened this issue Oct 7, 2015 · 0 comments

Comments

@metaColin
Copy link

From gulpfile.js in chapter 19.

gulp.task('nodemon', function() {
  nodemon({
    script: 'server.js',
    ext: 'js less html'
  })
    .on('start', ['watch'])
    .on('change', ['watch'])
    .on('restart', function() {
      console.log('Restarted!');
    });
});

Everytime a file changes, you're triggering watch which attaches additional listeners. After a few restarts, you will exceed the max number of listeners.

This should be rewritten to avoid memory leaks. Just remove the line which starts watch on change. It's redundant since start is triggered on restart anyway. I have made a pull request with the necessary fix.

metaColin added a commit to metaColin/mean-machine-code that referenced this issue Oct 8, 2015
See Issue scotch-io#32.

On change function is redundant and actually causes memory leaks once called enough.
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

1 participant