Skip to content

ng build for production on ng16 (webpack builder) has significantly higher memory pressure #25031

@jpike88

Description

@jpike88

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

15.1.5 (typescript version 4.9.5)

Description

After upgrading to ng16.0.0-RC0 (typescript 5.0.3), I've noticed a much higher load on my build runners, to the point of an out of memory error.

I run with NODE_OPTIONS="--max-old-space-size=8192" at all times.

Originally, builds would work fine on
buildjet-4vcpu-ubuntu-2204-arm, but with 16-RC0, I had to try buildjet-8vcpu-ubuntu-2204-arm, then buildjet-16vcpu-ubuntu-2204-arm until the memory crash didn't occur.

Below are the stats, to show where I started and where I ended up.
vCPU RAM YAML runner tag
4 vCPU 6 GB buildjet-4vcpu-ubuntu-2204-arm
8 vCPU 12 GB buildjet-8vcpu-ubuntu-2204-arm
16 vCPU 24 GB buildjet-16vcpu-ubuntu-2204-arm

So I went from just 6GB to needing somewhere between 12GB-24GB on my runners to not have an out of memory error. This cannot be easily explained by pointing at memory possibly used by other services.

Attached are two cpu profiles, named appropriately. These were taken on an M1 Max with 32GB RAM. Obviously the pipeline seemed to be quite different, so it's hard to tell where the memory bloat might be happening.

cpuProfiles.zip

Minimal Reproduction

Do a production build (including optimizations etc) with 15.1.5, then try with 16-RC0, compare memory usage

Exception or Error

No response

Your Environment

n/a because comparing two seperate versions of ng and typescript

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions