kevva / screenshot-stream

Capture screenshot of a website and return it as a stream
MIT License
236 stars 38 forks source link

Kill phantom process #34

Open ColemanGariety opened 8 years ago

ColemanGariety commented 8 years ago

Phatom itself doesn't seem to leak memory for me, however, when I close the screenshot stream, it seems like about ~40mb of data get left behind resulting in a serious memory leak.

I'm assuming that phantom is leaving something hanging around on its end, or not exiting?

It happens every time the node server throws Error: ECONNRESET.

ColemanGariety commented 8 years ago

I only write this as an issue here since I've attached an on('error') to every stream in my server, yet memory continues to leak. Perhaps a stream is getting left behind in index.js?

This one, maybe: https://github.com/kevva/screenshot-stream/blob/master/index.js#L56

sindresorhus commented 7 years ago

Not much we can do based on this information, but you could probably use node --inspect in latest Node.js version to inspect memory usage using DevTools and see where it's coming from.