Skip to content

Commit 34b1a64

Browse files
committedApr 26, 2016
doc: minor copy improvement in buffer.markdown
PR-URL: #5833 Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 829d613 commit 34b1a64

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed
 

‎doc/api/buffer.markdown

+17-18
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ use the shared internal memory pool.
103103
### The `--zero-fill-buffers` command line option
104104

105105
Node.js can be started using the `--zero-fill-buffers` command line option to
106-
force all newly allocated `Buffer` and `SlowBuffer` instances created using
107-
either `new Buffer(size)`, `Buffer.allocUnsafe(size)`,
108-
`Buffer.allocUnsafeSlow(size)` or `new SlowBuffer(size)` to be *automatically
109-
zero-filled* upon creation. Use of this flag *changes the default behavior* of
110-
these methods and *can have a significant impact* on performance. Use of the
111-
`--zero-fill-buffers` option is recommended only when absolutely necessary to
112-
enforce that newly allocated `Buffer` instances cannot contain potentially
113-
sensitive data.
106+
force all newly allocated `Buffer` instances created using either
107+
`new Buffer(size)`, `Buffer.allocUnsafe(size)`, `Buffer.allocUnsafeSlow(size)`
108+
or `new SlowBuffer(size)` to be *automatically zero-filled* upon creation. Use
109+
of this flag *changes the default behavior* of these methods and *can have a
110+
significant impact* on performance. Use of the `--zero-fill-buffers` option is
111+
recommended only when absolutely necessary to enforce that newly allocated
112+
`Buffer` instances cannot contain potentially sensitive data.
114113

115114
```
116115
$ node --zero-fill-buffers
@@ -342,8 +341,8 @@ console.log(buf);
342341
Allocates a new `Buffer` of `size` bytes. The `size` must be less than
343342
or equal to the value of `require('buffer').kMaxLength` (on 64-bit
344343
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
345-
thrown. If a `size` less than 0 is specified, a zero-length Buffer will be
346-
created.
344+
thrown. A zero-length Buffer will be created if a `size` less than or equal to
345+
0 is specified.
347346

348347
Unlike `ArrayBuffers`, the underlying memory for `Buffer` instances created in
349348
this way is *not initialized*. The contents of a newly created `Buffer` are
@@ -400,8 +399,8 @@ console.log(buf);
400399

401400
The `size` must be less than or equal to the value of
402401
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
403-
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. If a `size` less than 0
404-
is specified, a zero-length `Buffer` will be created.
402+
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
403+
be created if a `size` less than or equal to 0 is specified.
405404

406405
If `fill` is specified, the allocated `Buffer` will be initialized by calling
407406
`buf.fill(fill)`. See [`buf.fill()`][] for more information.
@@ -434,8 +433,8 @@ A `TypeError` will be thrown if `size` is not a number.
434433
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
435434
be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
436435
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
437-
thrown. If a `size` less than 0 is specified, a zero-length `Buffer` will be
438-
created.
436+
thrown. A zero-length Buffer will be created if a `size` less than or equal to
437+
0 is specified.
439438

440439
The underlying memory for `Buffer` instances created in this way is *not
441440
initialized*. The contents of the newly created `Buffer` are unknown and
@@ -476,8 +475,8 @@ additional performance that `Buffer.allocUnsafe(size)` provides.
476475
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
477476
`size` must be less than or equal to the value of
478477
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
479-
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. If a `size` less than 0
480-
is specified, a zero-length `Buffer` will be created.
478+
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
479+
be created if a `size` less than or equal to 0 is specified.
481480

482481
The underlying memory for `Buffer` instances created in this way is *not
483482
initialized*. The contents of the newly created `Buffer` are unknown and
@@ -1824,8 +1823,8 @@ has observed undue memory retention in their applications.
18241823
Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than
18251824
or equal to the value of `require('buffer').kMaxLength` (on 64-bit
18261825
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
1827-
thrown. If a `size` less than 0 is specified, a zero-length `SlowBuffer` will be
1828-
created.
1826+
thrown. A zero-length Buffer will be created if a `size` less than or equal to
1827+
0 is specified.
18291828

18301829
The underlying memory for `SlowBuffer` instances is *not initialized*. The
18311830
contents of a newly created `SlowBuffer` are unknown and could contain

0 commit comments

Comments
 (0)
Please sign in to comment.