-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Buffer documentation on pooling might be misleading #22139
Comments
ChALkeR
added
buffer
Issues and PRs related to the buffer subsystem.
doc
Issues and PRs related to the documentations.
labels
Aug 5, 2018
yes, if |
2 tasks
HarshithaKP
added a commit
to HarshithaKP/node
that referenced
this issue
Apr 7, 2020
Fixes: nodejs#22139 Co-authored-by: Mritunjay Goutam <mritunjaygoutam2204@gmail.com>
4 tasks
targos
pushed a commit
to targos/node
that referenced
this issue
Apr 25, 2020
Fixes: nodejs#22139 Co-authored-by: Mritunjay Goutam <mritunjaygoutam2204@gmail.com> PR-URL: nodejs#32703 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open https://nodejs.org/api/buffer.html or master/doc/api/buffer.md, and search for «pool».
Next match is in
Buffer.allocUnsafeSlow
docs (skipped here).In fact,
Buffer.from(arg)
is pooled:That is not documented in
Buffer.from
docs or anywhere where people would search for it — from the docs, it might look like automatic pooling is something that is used only forBuffer.allocUnsafe
.The only place that mentions that
Buffer.from(arg)
is pooled is «or sometimes when allocating a buffer smaller thanBuffer.poolSize
» clause in thebuf.byteOffset
documentation. Also, that one isn't even present in v8.x LTS docs.Perhaps,
Buffer.from
documentation should explicitly mention that it might return pooled buffers (asBuffer.allocUnsafe
does).The text was updated successfully, but these errors were encountered: