Skip to content

JavaScript heap out of memory when using cleanup-unused-imports #59813

@oliverdrummond

Description

@oliverdrummond

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

Every time I execute the ng generate @angular/core:cleanup-unused-imports schematic on my project, I get a "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory"

Is it possible to add a parameter to make it run on a folder level like the control flow schematic?

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Preparing analysis for projects/first-app/tsconfig.app.json
    Preparing analysis for projects/first-lib/tsconfig.lib.json
    Preparing analysis for projects/first-lib/tsconfig.lib.prod.json
    Preparing analysis for projects/shared-lib/tsconfig.lib.json
    Preparing analysis for projects/shared-lib/tsconfig.lib.prod.json
    Preparing analysis for projects/second-app-cockpit/tsconfig.app.json
    Preparing analysis for projects/second-app-shared-lib/tsconfig.lib.prod.json
    Preparing analysis for projects/second-app-shared-lib/tsconfig.lib.json
    Preparing analysis for projects/second-app-dashboard/tsconfig.app.json
    Preparing analysis for projects/third-app-cockpit/tsconfig.app.json
    Preparing analysis for projects/third-app-shared-lib/tsconfig.lib.prod.json
    Preparing analysis for projects/third-app-shared-lib/tsconfig.lib.json
    Preparing analysis for projects/fourth-app-cockpit/tsconfig.app.json
    Preparing analysis for projects/fourth-app-shared-lib/tsconfig.lib.prod.json
    Preparing analysis for projects/fourth-app-shared-lib/tsconfig.lib.json
    Preparing analysis for projects/first-app/tsconfig.spec.json

<--- Last few GCs --->

[13008:000001AA4F9FC0B0]   204999 ms: Mark-Compact 4051.8 (4141.3) -> 4037.2 (4142.5) MB, 1323.39 / 0.00 ms  (average mu = 0.236, current mu = 0.125) allocation failure; scavenge might not succeed
[13008:000001AA4F9FC0B0]   207571 ms: Mark-Compact 4055.6 (4145.1) -> 4043.1 (4148.1) MB, 2470.53 / 0.00 ms  (average mu = 0.123, current mu = 0.039) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF63B18413F node::SetCppgcReference+15695
 2: 00007FF63B0FEA56 EVP_MD_meth_get_input_blocksize+78566
 3: 00007FF63B100841 EVP_MD_meth_get_input_blocksize+86225
 4: 00007FF63BB6A5E1 v8::Isolate::ReportExternalAllocationLimitReached+65
 5: 00007FF63BB53D78 v8::Function::Experimental_IsNopFunction+1336
 6: 00007FF63B9B55E0 v8::Platform::SystemClockTimeMillis+659552
 7: 00007FF63B9B2668 v8::Platform::SystemClockTimeMillis+647400
 8: 00007FF63B9C797A v8::Platform::SystemClockTimeMillis+734202
 9: 00007FF63B9C81F7 v8::Platform::SystemClockTimeMillis+736375
10: 00007FF63B9D6B1F v8::Platform::SystemClockTimeMillis+796063
11: 00007FF63B6970E5 v8::CodeEvent::GetFunctionName+116773
12: 00007FF5DBBDAAFA

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.1.5
Node: 22.13.0
Package Manager: npm 11.0.0
OS: win32 x64

Angular: 19.1.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.5
@angular-devkit/build-angular   19.1.5
@angular-devkit/core            19.1.5
@angular-devkit/schematics      19.1.5
@angular/cdk                    19.1.2
@angular/cli                    19.1.5
@schematics/angular             19.1.5
ng-packagr                      19.1.2
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: migrationsIssues related to `ng update`/`ng generate` migrations

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions