Skip to content

Commit 89c837a

Browse files
kvakiljuanarbol
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 <[email protected]>
1 parent 0c76e01 commit 89c837a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

doc/api/worker_threads.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -977,14 +977,17 @@ changes:
977977
are passed in `workerData`, a `transferList` is required for those
978978
items or [`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`][] is thrown.
979979
See [`port.postMessage()`][] for more information.
980-
* `resourceLimits` {Object} An optional set of resource limits for the new
981-
JS engine instance. Reaching these limits leads to termination of the
982-
`Worker` instance. These limits only affect the JS engine, and no external
983-
data, including no `ArrayBuffer`s. Even if these limits are set, the process
984-
may still abort if it encounters a global out-of-memory situation.
985-
* `maxOldGenerationSizeMb` {number} The maximum size of the main heap in MB.
980+
* `resourceLimits` {Object} An optional set of resource limits for the new JS
981+
engine instance. Reaching these limits leads to termination of the `Worker`
982+
instance. These limits only affect the JS engine, and no external data,
983+
including no `ArrayBuffer`s. Even if these limits are set, the process may
984+
still abort if it encounters a global out-of-memory situation.
985+
* `maxOldGenerationSizeMb` {number} The maximum size of the main heap in
986+
MB. If the command-line argument [`--max-old-space-size`][] is set, it
987+
overrides this setting.
986988
* `maxYoungGenerationSizeMb` {number} The maximum size of a heap space for
987-
recently created objects.
989+
recently created objects. If the command-line argument
990+
[`--max-semi-space-size`][] is set, it overrides this setting.
988991
* `codeRangeSizeMb` {number} The size of a pre-allocated memory range
989992
used for generated code.
990993
* `stackSizeMb` {number} The default maximum stack size for the thread.
@@ -1320,6 +1323,8 @@ thread spawned will spawn another until the application crashes.
13201323
[`'close'` event]: #event-close
13211324
[`'exit'` event]: #event-exit
13221325
[`'online'` event]: #event-online
1326+
[`--max-old-space-size`]: cli.md#--max-old-space-sizesize-in-megabytes
1327+
[`--max-semi-space-size`]: cli.md#--max-semi-space-sizesize-in-megabytes
13231328
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
13241329
[`AsyncResource`]: async_hooks.md#class-asyncresource
13251330
[`Buffer.allocUnsafe()`]: buffer.md#static-method-bufferallocunsafesize

0 commit comments

Comments
 (0)