Skip to content

Commit b660b74

Browse files
kvakilRafaelGSS
authored andcommitted
doc,worker: document resourceLimits overrides
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4ae1f49 commit b660b74

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

doc/api/worker_threads.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,17 @@ changes:
983983
are passed in `workerData`, a `transferList` is required for those
984984
items or [`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`][] is thrown.
985985
See [`port.postMessage()`][] for more information.
986-
* `resourceLimits` {Object} An optional set of resource limits for the new
987-
JS engine instance. Reaching these limits leads to termination of the
988-
`Worker` instance. These limits only affect the JS engine, and no external
989-
data, including no `ArrayBuffer`s. Even if these limits are set, the process
990-
may still abort if it encounters a global out-of-memory situation.
991-
* `maxOldGenerationSizeMb` {number} The maximum size of the main heap in MB.
986+
* `resourceLimits` {Object} An optional set of resource limits for the new JS
987+
engine instance. Reaching these limits leads to termination of the `Worker`
988+
instance. These limits only affect the JS engine, and no external data,
989+
including no `ArrayBuffer`s. Even if these limits are set, the process may
990+
still abort if it encounters a global out-of-memory situation.
991+
* `maxOldGenerationSizeMb` {number} The maximum size of the main heap in
992+
MB. If the command-line argument [`--max-old-space-size`][] is set, it
993+
overrides this setting.
992994
* `maxYoungGenerationSizeMb` {number} The maximum size of a heap space for
993-
recently created objects.
995+
recently created objects. If the command-line argument
996+
[`--max-semi-space-size`][] is set, it overrides this setting.
994997
* `codeRangeSizeMb` {number} The size of a pre-allocated memory range
995998
used for generated code.
996999
* `stackSizeMb` {number} The default maximum stack size for the thread.
@@ -1328,6 +1331,8 @@ thread spawned will spawn another until the application crashes.
13281331
[`'close'` event]: #event-close
13291332
[`'exit'` event]: #event-exit
13301333
[`'online'` event]: #event-online
1334+
[`--max-old-space-size`]: cli.md#--max-old-space-sizesize-in-megabytes
1335+
[`--max-semi-space-size`]: cli.md#--max-semi-space-sizesize-in-megabytes
13311336
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
13321337
[`AsyncResource`]: async_hooks.md#class-asyncresource
13331338
[`Buffer.allocUnsafe()`]: buffer.md#static-method-bufferallocunsafesize

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy