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:
- Instance tsc with
node --max_old_space_size=4096 tsc ...
- 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
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
tscmem?There are only 2 solutions I found:
node --max_old_space_size=4096 tsc ...NODE_OPTIONS=--max-old-space-size=4096this works for my CI, but it does not work depending your node compile bin 😢
Issue: I can't tweak
max_old_space_sizewith the libIt's due to this line
tsc-watch/lib/tsc-watch.js
Line 83 in 567182a
For instance if I add such param it works (just to try)
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?
--maxNodeMem ####in theextractArgsmethod--max_old_space_size=if this variable is setIf you like this solution, I will implement it.
Impact
no regression at all
(
--maxMemhas to be explicitely specified)ℹ️ Note I will do the PR