mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
doc: fix Buffer.allocUnsafe documentation
PR-URL: https://github.com/nodejs/node/pull/50686 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
parent
86593e5267
commit
2d1bc3d130
@ -808,8 +808,8 @@ A `TypeError` will be thrown if `size` is not a number.
|
||||
The `Buffer` module pre-allocates an internal `Buffer` instance of
|
||||
size [`Buffer.poolSize`][] that is used as a pool for the fast allocation of new
|
||||
`Buffer` instances created using [`Buffer.allocUnsafe()`][], [`Buffer.from(array)`][],
|
||||
and [`Buffer.concat()`][] only when `size` is less than or equal to
|
||||
`Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`][] divided by two).
|
||||
and [`Buffer.concat()`][] only when `size` is less than
|
||||
`Buffer.poolSize >>> 1` (floor of [`Buffer.poolSize`][] divided by two).
|
||||
|
||||
Use of this pre-allocated internal memory pool is a key difference between
|
||||
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user