Skip to content

Commit a2aa52b

Browse 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

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

doc/api/buffer.md

+3-4
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)