镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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

  1. added
    docIssues and PRs related to Node.js documentation.
    on Nov 9, 2023
  2. changed the title [-]Buffer.allocUnsafe has a imprecise information[/-] [+]Buffer.allocUnsafe has a incorrect information[/+] on Nov 10, 2023
  3. mertcanaltin commented on Nov 12, 2023

    @mertcanaltin
    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

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