You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
library builder: watch mode runs out of memory with many entry points #34126
The initial --watch build of ngwr (228 entry points) dies after 77 of them with "Reached heap limit" on the default Node heap (~4.2 GB). It's the entry point count, not the library: a generated library of 120 trivial entry points dies after 60.
Minimal Reproduction
Generate a library with 120 secondary entry points, each a six-line standalone component with an inline template, no styles.
ng build mylib --watch on the default Node heap.
FATAL ERROR: Reached heap limit after ~60 entry points.
Peak RSS of the initial watch build under a large heap grows linearly: 30 entry points 2.3 GB, 60 4.1 GB, 120 7.6 GB, about 60 MB per entry point.
Exception or Error
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Your Environment
@angular/build built from #34106 (e1fa5796) with the repo's own bazel build
Angular CLI 22.1.8
Angular 22.1.7
Node 24.16.0
pnpm 11
macOS 25.6, 14 cores, 24 GB
Anything else relevant?
Watch compiles on the main thread and keeps node.cachedProgram for every entry point, and each one holds its own parsed copy of the .d.ts graph (per-instance sourceFiles in typescript-compilation.ts), so nothing is shared between entry points.
With --max-old-space-size=17000 it works, and incremental rebuilds are great: 70-110 ms, only the touched entry point recompiles. That's probably why your cold watch run of ngwr was fine. A shared source file cache across entry points would likely fix it; otherwise a documented heap requirement would help, since the crash itself gives no hint that entry point count is the cause.
Activity
alan-agius4 commentedon Sep 18, 2026
This should already have been solved.
e1fa5796had a defect in watch mode.thekhegay commentedon Sep 18, 2026
@alan-agius4 You're right, I tested
e1fa5796and filed this after your push, sorry for the noiseangular-automatic-lock-bot commentedon Oct 22, 2026
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.