Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a2aa52b

Browse filesBrowse files
sinkhahaMoLow
authored andcommitted
doc: update Buffer.allocUnsafe description
PR-URL: #48183 Fixes: #42821 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent a9d0b8d commit a2aa52b
Copy full SHA for a2aa52b

File tree

Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/buffer.md‎

Copy file name to clipboardExpand all lines: doc/api/buffer.md
+3-4Lines changed: 3 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,9 @@ A `TypeError` will be thrown if `size` is not a number.
805805

806806
The `Buffer` module pre-allocates an internal `Buffer` instance of
807807
size [`Buffer.poolSize`][] that is used as a pool for the fast allocation of new
808-
`Buffer` instances created using [`Buffer.allocUnsafe()`][],
809-
[`Buffer.from(array)`][], [`Buffer.concat()`][], and the deprecated
810-
`new Buffer(size)` constructor only when `size` is less than or equal
811-
to `Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`][] divided by two).
808+
`Buffer` instances created using [`Buffer.allocUnsafe()`][], [`Buffer.from(array)`][],
809+
and [`Buffer.concat()`][] only when `size` is less than or equal to
810+
`Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`][] divided by two).
812811

813812
Use of this pre-allocated internal memory pool is a key difference between
814813
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.