You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
The text was updated successfully, but these errors were encountered:
edin-m
changed the title
Streams: Is the .on('data', ...) same as .pipe(..., { end: false})
Streams: Is the .on('data', ...) same as .pipe(..., { end: false}) ?
May 17, 2015
I suspect that pipe() slows ZeroStream down requesting data only when it's needed. But on('data') callback fires as soon as any data is available. Thus, in case of on('data') you'll get 100mb of zeroes all at once, but with pipe() you'll generate zeroes when previous data is sent over the wire.
I see no memory leak there, just an inefficient use of the memory. It should get freed up when tcp connection is closed.
I have read about streams multiple times and I have tried and made some of my own small streams.
I have created stream of zeroes (with buffers) that are sent over TCP on TCP client's command.
Stream is generated by readable stream.
However if I use:
memory usage goes to infinity with OS shutting down the process.
And if I use
I get no memory performance issues.
Am I misunderstanding streams or is this potentially real memory leak.
https://gist.github.com/edin-m/2c1391e36a0ee6a9c084
The text was updated successfully, but these errors were encountered: