From e2484b24cbe678b3aa349e047be5494308161863 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Sat, 16 May 2020 14:53:36 +0300 Subject: [PATCH] doc: add comment about highWaterMark limit Add a comment regarding memory limits and setting highWaterMark PR-URL: https://github.com/nodejs/node/pull/33432 Reviewd-By: Colin Ihrig Reviewed-By: Robert Nagy Reviewed-By: Colin Ihrig Reviewed-By: Matteo Collina Reviewed-By: Ben Noordhuis Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- doc/api/stream.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 2801d2e7e8d4dd..6dda48f9a25d64 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -93,6 +93,11 @@ A key goal of the `stream` API, particularly the [`stream.pipe()`][] method, is to limit the buffering of data to acceptable levels such that sources and destinations of differing speeds will not overwhelm the available memory. +The `highWaterMark` option is a threshold, not a limit: it dictates the amount +of data that a stream buffers before it stops asking for more data. It does not +enforce a strict memory limitation in general. Specific stream implementations +may choose to enforce stricter limits but doing so is optional. + Because [`Duplex`][] and [`Transform`][] streams are both `Readable` and `Writable`, each maintains *two* separate internal buffers used for reading and writing, allowing each side to operate independently of the other while