@@ -379,9 +379,10 @@ A `TypeError` will be thrown if `size` is not a number.
379
379
380
380
The ` Buffer ` module pre-allocates an internal ` Buffer ` instance of
381
381
size [ ` Buffer.poolSize ` ] [ ] that is used as a pool for the fast allocation of new
382
- ` Buffer ` instances created using [ ` Buffer.allocUnsafe() ` ] [ ] and the deprecated
383
- ` new Buffer(size) ` constructor only when ` size ` is less than or equal to
384
- ` Buffer.poolSize >> 1 ` (floor of [ ` Buffer.poolSize ` ] [ ] divided by two).
382
+ ` Buffer ` instances created using [ ` Buffer.allocUnsafe() ` ] [ ] ,
383
+ [ ` Buffer.from(array) ` ] [ ] , and the deprecated ` new Buffer(size) ` constructor only
384
+ when ` size ` is less than or equal to ` Buffer.poolSize >> 1 ` (floor of
385
+ [ ` Buffer.poolSize ` ] [ ] divided by two).
385
386
386
387
Use of this pre-allocated internal memory pool is a key difference between
387
388
calling ` Buffer.alloc(size, fill) ` vs. ` Buffer.allocUnsafe(size).fill(fill) ` .
@@ -571,6 +572,9 @@ const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
571
572
A ` TypeError ` will be thrown if ` array ` is not an ` Array ` or other type
572
573
appropriate for ` Buffer.from() ` variants.
573
574
575
+ ` Buffer.from(array) ` and [ ` Buffer.from(string) ` ] [ ] may also use the internal
576
+ ` Buffer ` pool like [ ` Buffer.allocUnsafe() ` ] [ ] does.
577
+
574
578
### Class Method: ` Buffer.from(arrayBuffer[, byteOffset[, length]]) `
575
579
<!-- YAML
576
580
added: v5.10.0
@@ -2733,10 +2737,11 @@ to one of these new APIs.*
2733
2737
uninitialized, the allocated segment of memory might contain old data that is
2734
2738
potentially sensitive.
2735
2739
2736
- ` Buffer ` instances returned by [ ` Buffer.allocUnsafe() ` ] [ ] * may* be allocated off
2737
- a shared internal memory pool if ` size ` is less than or equal to half
2738
- [ ` Buffer.poolSize ` ] [ ] . Instances returned by [ ` Buffer.allocUnsafeSlow() ` ] [ ]
2739
- * never* use the shared internal memory pool.
2740
+ ` Buffer ` instances returned by [ ` Buffer.allocUnsafe() ` ] [ ] and
2741
+ [ ` Buffer.from(array) ` ] [ ] * may* be allocated off a shared internal memory pool
2742
+ if ` size ` is less than or equal to half [ ` Buffer.poolSize ` ] [ ] . Instances
2743
+ returned by [ ` Buffer.allocUnsafeSlow() ` ] [ ] * never* use the shared internal
2744
+ memory pool.
2740
2745
2741
2746
### The ` --zero-fill-buffers ` command line option
2742
2747
<!-- YAML
0 commit comments