From ed451c608ddacb2f4392db8cf8ca20357ed0e98f Mon Sep 17 00:00:00 2001 From: "mert.altin" Date: Sun, 12 Nov 2023 16:47:53 +0300 Subject: [PATCH 1/2] doc: fixed misinformation in Buffer.allocUnsafe method --- doc/api/buffer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 3a46599649d025..7a159c8cba3400 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -809,7 +809,7 @@ 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). +`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)`. From 03f6ba51e20e2ff5145ed62f0caea9b2b7a7e44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 12 Nov 2023 20:59:33 +0300 Subject: [PATCH 2/2] Update buffer.md Co-authored-by: Leonardo Peixoto <67864816+peixotoleonardo@users.noreply.github.com> --- doc/api/buffer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 7a159c8cba3400..7bb7d42454fad6 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -808,7 +808,7 @@ 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 +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