Skip to content

Angular Language Service extension crashes with “Out of heap memory” after large branch switch and cannot recover #2231

@berg380

Description

@berg380

Description

When switching Git branches with several thousand file differences (>5000) in a medium-to-large Angular monorepo (~2600 .ts, ~1000 .html files), the Angular Language Service (ALS) extension frequently crashes with an “Out of heap memory” error.

This happens even on machines with plenty of RAM.

Repeated branch switches (without restarting VS Code) seem to exacerbate the issue.
After the ALS extension crashes, it is unable to recover automatically — it gets stuck in an endless “Initializing Angular language features” loop and no longer performs template type checking until the user manually restarts VS Code or uses Reload Window.

When not switching branches, ALS operates normally and stabilizes at around 2.7 GB of memory with ~100 HTML files open from different libraries.
We greatly appreciate the template type checking provided by the ALS extension — this is the only issue interrupting otherwise smooth operation.

System and project information

OS: Windows 11 (x64)
VS Code: 1.xx.x (x64)
Node.js: 20.12.1 (x64)
TypeScript: 5.4.5
Angular: 18.2.8
Angular Language Service: 18.2.8
Angular Language Service Extension: 18.2.0
Angular Language Service Extension dependencies: ALS v18.2.0-rc.0, TS v5.5.3

Project context

Monorepo with 8 libraries, 4 containing most of the templates.

Desired (workaround) solution

A way to increase the heap size for the ALS extension process beyond the 4096 MB limit

Desired solution

The ALS extension handles memory spikes during large branch switches without exceeding the heap limit or accumulating memory with each branch change.
The ALS extension can recover automatically after an “Out of heap memory” error, without requiring a VS Code restart or Reload Window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions