From a7f61af196861382028276b3f36452e1e1bfb9e0 Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Tue, 6 Apr 2021 22:49:45 +0800 Subject: [PATCH 1/4] doc: update `buffer.constants.MAX_LENGTH` Fixes: https://github.com/nodejs/node/issues/38093 --- doc/api/buffer.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 176e53ffe5177e..e62afc4271b0e6 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3415,7 +3415,13 @@ added: v8.2.0 * {integer} The largest size allowed for a single `Buffer` instance. On 32-bit architectures, this value currently is 230 - 1 (~1GB). -On 64-bit architectures, this value currently is 231 - 1 (~2GB). +On 64-bit architectures, this value currently is + +* for v12: 231 - 1 (~2GB) +* for v14: 232 - 1 (~4GB) +* for v15: 232(~4GB) + +It reflects [`v8::TypedArray::kMaxLength`][] under the hood. This value is also available as [`buffer.kMaxLength`][]. @@ -3589,3 +3595,4 @@ introducing security vulnerabilities into an application. [binary strings]: https://developer.mozilla.org/en-US/docs/Web/API/DOMString/Binary [endianness]: https://en.wikipedia.org/wiki/Endianness [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols +[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0 From 1471e99fc099e0d31bcd6859f8788dd093b3f1cf Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Tue, 6 Apr 2021 23:49:35 +0800 Subject: [PATCH 2/4] fixup: doc: update `buffer.constants.MAX_LENGTH` --- doc/api/buffer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index e62afc4271b0e6..b21cdb1e7a2015 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3591,8 +3591,8 @@ introducing security vulnerabilities into an application. [`buffer.constants.MAX_STRING_LENGTH`]: #buffer_buffer_constants_max_string_length [`buffer.kMaxLength`]: #buffer_buffer_kmaxlength [`util.inspect()`]: util.md#util_util_inspect_object_options +[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0 [base64url]: https://tools.ietf.org/html/rfc4648#section-5 [binary strings]: https://developer.mozilla.org/en-US/docs/Web/API/DOMString/Binary [endianness]: https://en.wikipedia.org/wiki/Endianness [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols -[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0 From 06fb5650b7651e02620f03c99e47994f76359c0a Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Wed, 7 Apr 2021 21:39:45 +0800 Subject: [PATCH 3/4] fixup: doc: update `buffer.constants.MAX_LENGTH` --- doc/api/buffer.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b21cdb1e7a2015..ab50e03c11d714 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3410,16 +3410,24 @@ added: v8.2.0 #### `buffer.constants.MAX_LENGTH` * {integer} The largest size allowed for a single `Buffer` instance. On 32-bit architectures, this value currently is 230 - 1 (~1GB). -On 64-bit architectures, this value currently is -* for v12: 231 - 1 (~2GB) -* for v14: 232 - 1 (~4GB) -* for v15: 232(~4GB) +On 64-bit architectures, this value varies from Node.js version to version. +It is at least 231 - 1 (~2GB) and currently is 232 +(~4GB). See history for detail. It reflects [`v8::TypedArray::kMaxLength`][] under the hood. From a2f9c9ebe4e907349aee83ba384715c58529d04d Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Thu, 8 Apr 2021 09:24:36 +0800 Subject: [PATCH 4/4] fixup: doc: update `buffer.constants.MAX_LENGTH` --- doc/api/buffer.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index ab50e03c11d714..e7183121b6daa3 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3413,21 +3413,19 @@ added: v8.2.0 changes: - version: v15.0.0 pr-url: https://github.com/nodejs/node/pull/35415 - description: Value is changed to 232 (~4GB) on 64-bit + description: Value is changed to 232 on 64-bit architectures. - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/32116 - description: Value is changed to 232 - 1 (~4GB) on 64-bit - architectures. + description: Value is changed from 231 - 1 to + 232 - 1 on 64-bit architectures. --> * {integer} The largest size allowed for a single `Buffer` instance. On 32-bit architectures, this value currently is 230 - 1 (~1GB). -On 64-bit architectures, this value varies from Node.js version to version. -It is at least 231 - 1 (~2GB) and currently is 232 -(~4GB). See history for detail. +On 64-bit architectures, this value currently is 232 (~4GB). It reflects [`v8::TypedArray::kMaxLength`][] under the hood.