From 4749156f4b199dce87320e61b6f6c71ee4f03b02 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 ae29a38b8f4b5d..ebfff5f0dfe572 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