Skip to content

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

Closed
@pette9

Description

@pette9

🐞 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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions