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

Buffer.allocUnsafe has a incorrect information #50635

Closed
peixotoleonardo opened this issue Nov 9, 2023 · 1 comment
Closed

Buffer.allocUnsafe has a incorrect information #50635

peixotoleonardo opened this issue Nov 9, 2023 · 1 comment
Labels
doc Issues and PRs related to the documentations.

Comments

@peixotoleonardo
Copy link
Contributor

peixotoleonardo commented Nov 9, 2023

Affected URL(s)

https://nodejs.org/dist/latest-v20.x/docs/api/buffer.html#static-method-bufferallocunsafesize

Description of the problem

The documentation has a incorrect information about the logic to pre-allocate an internal Buffer.

In the documentation has:

... only when size is less than or equal to Buffer.poolSize >> 1 (floor of Buffer.poolSize divided by two).

However, in the code is:

if (size < (Buffer.poolSize >>> 1)) {

@peixotoleonardo peixotoleonardo added the doc Issues and PRs related to the documentations. label Nov 9, 2023
@peixotoleonardo peixotoleonardo changed the title Buffer.allocUnsafe has a imprecise information Buffer.allocUnsafe has a incorrect information Nov 10, 2023
@mertcanaltin
Copy link
Member

many thanks for your suggestion I opened a pr for this @peixotoleonardo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations.
Projects
None yet
Development

No branches or pull requests

2 participants