Skip to content

Buffer.allocUnsafe has a incorrect information #50635

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions