Skip to content

worker: add flag to control old space size

Rodrigo Muino Tomonari requested to merge github/fork/kvakil/worker-flag into main

This adds a new flag --thread-max-old-space-size (name completely provisional). This flag lets the user configure the size of the main thread's old space size. This has two advantages over the existing --max-old-space-size flag:

  1. It allows setting the old space size for the main thread and using resourceLimits for worker threads. Currently resourceLimits will be ignored when --max-old-space-size is set (see the attached issues).
  2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed.

The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate --max-old-space-size, since the semantics feel pretty error-prone, but that's a story for another day.

Refs: https://github.com/nodejs/node/issues/41066 Refs: https://github.com/nodejs/node/issues/43991 Refs: https://github.com/nodejs/node/pull/43992

Merge request reports

Loading