Skip to content

Buffer.allocUnsafe has a incorrect information #50635

@peixotoleonardo

Description

@peixotoleonardo

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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions