Skip to content

Commit

Permalink
doc: revise --zero-fill-buffers text in buffer.md
Browse files Browse the repository at this point in the history
There was an unclear sentence fragment that needed fixing, so I edited
the entire paragraph for clarity. I also removed irrelevant information
about behavior before Node.js 8.0.0. That version of Node.js is no
longer supported and these docs will never apply to 8.0.0. (At the time
of this writing, 10.x is the oldest supported line, and so changes to
the docs will never be backported farther than the 10.x docs.)

PR-URL: #32019
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and codebytere committed Mar 3, 2020
1 parent 49864d1 commit cd30dbb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,12 @@ added: v5.10.0
-->

Node.js can be started using the `--zero-fill-buffers` command line option to
cause all newly allocated `Buffer` instances to be zero-filled upon creation by
default. Before Node.js 8.0.0, this included buffers allocated by `new
Buffer(size)`. Since Node.js 8.0.0, buffers allocated with `new` are always
zero-filled, whether this option is used or not.
[`Buffer.allocUnsafe()`][], [`Buffer.allocUnsafeSlow()`][], and `new
SlowBuffer(size)`. Use of this flag can have a significant negative impact on
performance. Use of the `--zero-fill-buffers` option is recommended only when
necessary to enforce that newly allocated `Buffer` instances cannot contain old
data that is potentially sensitive.
cause all newly-allocated `Buffer` instances to be zero-filled upon creation by
default. Without the option, buffers created with [`Buffer.allocUnsafe()`][],
[`Buffer.allocUnsafeSlow()`][], and `new SlowBuffer(size)` are not zero-filled.
Use of this flag can have a significant negative impact on performance. Use the
`--zero-fill-buffers` option only when necessary to enforce that newly allocated
`Buffer` instances cannot contain old data that is potentially sensitive.

```console
$ node --zero-fill-buffers
Expand Down

0 comments on commit cd30dbb

Please sign in to comment.