Closed sangalao closed 10 months ago
The "max_old_space_size" parameter seems to mainly apply to the MAIN V8 isolate, so I'm not able to configure "global" memory consumption during build phase. Is there a parameter to configure the GLOBAL heap used by NodeJS process for building phase ? If not, I think it could be useful to have one, and/or be able to fine-tune memory for all V8 isolates with high memory consumption
No, Node.js does not provide a global way of doing so. What you can do however is use NG_BUILD_MAX_WORKERS
to reduce the number of workers used at the cost of increasing the build time.
I cannot find any documentation explaning the fact that "production > optimization > scripts" option can result in high memory consumption, why it takes such memory, how I could tune it. Is is possible to have such a documentation / explanation ?
This is expected when using the Webpack and terser build pipeline, three-shaking and dead code elimination are resource intensive tasks that lead to increased in memory and CPU usage. There are no settings to fine-tune this or reduce the memory usage.
I also found this issue about memory limits for several "V8 isolates" in NodeJS, and was wondering whether it could be linked to my issue : https://github.com/nodejs/node/issues/43991
No really, as that issues mentions that max_old_space_size
is overridding the resourceLimits.maxOldSpaceSizeMb
that is passed to each worker which we do not use.
I am not seeing anything that is actionable from our end here.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Hello,
The build command I run for my project is :
This commands runs successfully, but however the NodeJS process for building app takes up to 10GB.
To be more precise, during beginning-middle of building phase it takes less than 4GB, and always at the middle-end of building phase, it goes up to 10GB just before end of successful build.
To start investigation, I launched build command with "-trace-gc" option :
I saw, with this option, that there are several Node "V8 isolates" that are created in the same NodeJS process ("V8 isolate" = JS Heap instance, based on Node GC documentation) :
Among those "V8 isolates", with a proper heap for each, 2 of them have particular high heap amount at the same time :
What also have to be noticed is that the second one consumes such a memory ONLY when option "production > optimization > scripts" in "angular.json" is set to true. The "production > optimization > scripts" option in "angular.json" is required for my production performance requirements (minification, tree-shaking, dead-code elimination).
So my questions/remarks are :
The "max_old_space_size" parameter seems to mainly apply to the MAIN V8 isolate, so I'm not able to configure "global" memory consumption during build phase. Is there a parameter to configure the GLOBAL heap used by NodeJS process for building phase ? If not, I think it could be useful to have one, and/or be able to fine-tune memory for all V8 isolates with high memory consumption
I cannot find any documentation explaning the fact that "production > optimization > scripts" option can result in high memory consumption, why it takes such memory, how I could tune it. Is is possible to have such a documentation / explanation ?
I also found this issue about memory limits for several "V8 isolates" in NodeJS, and was wondering whether it could be linked to my issue : https://github.com/nodejs/node/issues/43991
Thanks
Note : I was also facing same issue with Angular 14 : https://github.com/angular/angular-cli/issues/26553
Minimal Reproduction
Command run :
Packages :
Exception or Error
No response
Your Environment
Anything else relevant?
No response