-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
fs: reduce memory retention when streaming small files #21968
Conversation
/cc @nodejs/benchmarking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, but lint fails.
Also, this probably needs benchmarking.
CI: https://ci.nodejs.org/job/node-test-pull-request/16003/ (edit: green up to cancelled arm build) |
Benchmark results:
Since there really isn’t any reason why the encoding should matter here, and we should expect 0.6 false positives, I’d ignore the one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Could this be effecting also 'net'
?
@mcollina You mean, the same bug there? No, that’s not the case, because we shrink the buffer in native land before handing it over to JS. I’ve thought about implementing similar pooling there, though, as part of looking into https://github.com/nodejs-private/security/issues/186 (for those who can’t see it: it’s the bug that was resolved in 3217e8e). |
@addaleax Thx! there are a few cases in HTTP applications where I have seen very high RSS vs heap usage, without a leak. The effect looks very similar to this one. |
Landed in e3a4702 |
Fixes: #21967 PR-URL: #21968 Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
/cc @nodejs/lts ? |
Fixes: #21967 PR-URL: #21968 Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #21967
/cc @nodejs/fs
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes