Skip to content

Be able to tweak node memory #137

@pp0rtal

Description

@pp0rtal

Description

Default node memory can be surprisingly lower I'm running tsc over the client, for an app requiring 2-3GB of RAM In rare case: some CI, some developers low-profile workstation, it crashes. Actually it even hang forever because I'm not able to catch the right info at client level but that's another topic https://github.com//issues/136 😄

Reasons: for a same Node version but various compiled bin, memory can differ.
Here is some article about node mem https://medium.com/geekculture/node-js-default-memory-settings-3c0fe8a9ba1

How to upgrade tsc mem?

There are only 2 solutions I found:

  1. Instance tsc with node --max_old_space_size=4096 tsc ...
  2. Tweak an env variable NODE_OPTIONS=--max-old-space-size=4096
    this works for my CI, but it does not work depending your node compile bin 😢

Issue: I can't tweak max_old_space_size with the lib

It's due to this line

const tscProcess = spawn('node', [bin, ...args]);

For instance if I add such param it works (just to try)

const tscProcess = spawn('node', ["--max_old_space_size=4096", bin, ...args]); 

RFC: fix it forever

I suggest the simple solution to just be able to tweak node mem.
We would add alternatively a way to support any node option, overkill right?

  • Just add ability to set a --maxNodeMem #### in the extractArgs method
  • Call node with --max_old_space_size= if this variable is set

If you like this solution, I will implement it.

Impact

no regression at all
(--maxMem has to be explicitely specified)

ℹ️ Note I will do the PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions