Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@angular-devkit/build-angular v12.0.1 uses too much memory compared to v12.0.0 #20883

Closed
14 tasks
pette9 opened this issue May 21, 2021 · 1 comment · Fixed by #20886
Closed
14 tasks

@angular-devkit/build-angular v12.0.1 uses too much memory compared to v12.0.0 #20883

pette9 opened this issue May 21, 2021 · 1 comment · Fixed by #20886

Comments

@pette9
Copy link

pette9 commented May 21, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • [x ] build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: @angular-devkit/build-angular v12.0.0

Description

When you run ng build --configuration production on a medium or large application using @angular-devkit/build-angular v12.0.1. The command uses all the available memory (in my case 12 GB) before failing with a Javascript heap out of memory error The same command on the same application using @angular-devkit/build-angular v12.0.0 uses 2.7 GB at peak and builds successfully. For a small application, the command same using @angular-devkit/build-angular v12.0.1 does not fail but the difference in memory usage is very high compared to v12.0.0. For example in another smaller application that v12.0.1 uses 2.7 GB of memory, v12.0.0 uses 1.3 GB.

🔬 Minimal Reproduction

On an angular-cli created application, with @angular-devkit/build-angular v12.0.0 run the command ng build --configuration production and observe the memory usage. Update the same package to v12.0.1 and run the command the second time and observe the memory usage difference.

🔥 Exception or Error

On a large or medium application and depending on the size of the computer's RAM. you may encounter.


Javascript heap out of memory error

🌍 Your Environment




    _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.0.1
Node: 14.17.0
Package Manager: npm 6.14.13
OS: linux x64

Angular: 12.0.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, localize, material
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.1
@angular/flex-layout            12.0.0-beta.34
@schematics/angular             12.0.1
rxjs                            6.6.7
typescript                      4.2.4

Anything else relevant?

@ngbot ngbot bot added this to the Backlog milestone May 21, 2021
@alan-agius4 alan-agius4 self-assigned this May 21, 2021
clydin pushed a commit that referenced this issue May 21, 2021
…lism for components styles

Since we rely on child compilations to compile components CSS, using the `parallel` option will cause a significant overhead because each compilation will need to spawn a worker, in this mode the worker limit is not be honored because `css-minimizer-webpack-plugin` spawn and calulators workers during the optimization phase of a compilation and not globally per instance hence causes OOM because a large number of workers to be spawned simultaneously.

Closes #20883
clydin pushed a commit that referenced this issue May 21, 2021
…lism for components styles

Since we rely on child compilations to compile components CSS, using the `parallel` option will cause a significant overhead because each compilation will need to spawn a worker, in this mode the worker limit is not be honored because `css-minimizer-webpack-plugin` spawn and calulators workers during the optimization phase of a compilation and not globally per instance hence causes OOM because a large number of workers to be spawned simultaneously.

Closes #20883

(cherry picked from commit 1ab2ef9)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.