Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: revise --zero-fill-buffers text in buffer.md #32019

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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