X Tutup
The Wayback Machine - https://web.archive.org/web/20250518105402/https://github.com/angular/angular-cli/issues/22352
Skip to content

JavaScript heap out of memory after running serve#22352

Closed
@wesselvdv

Description

@wesselvdv

馃悶 Bug report

Command (mark with an x)

  • new
  • 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 CLI v12

Description

Running ng serve with NODE_OPTIONS=--max_old_space_size=8192 it will eventually give an out of memory error.

馃敩 Minimal Reproduction

Running ng serve (NODE_OPTIONS) on my project causes it to fail with out of memory exception.

馃敟 Exception or Error


Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disable-host-check" if that's the
case.
鉅� Generating browser application bundles (phase: setup)...

Wrote snapshot to /workspace/apps/client/Heap.20211210.155509.82.0.001.heapsnapshot

<--- Last few GCs --->

[82:0x7fca98135330]    51036 ms: Scavenge 1019.0 (1042.8) -> 1017.5 (1042.8) MB, 3.4 / 0.0 ms  (average mu = 0.263, current mu = 0.204) allocation failure
[82:0x7fca98135330]    51052 ms: Scavenge 1019.3 (1042.8) -> 1017.9 (1043.1) MB, 3.1 / 0.0 ms  (average mu = 0.263, current mu = 0.204) allocation failure
[82:0x7fca98135330]    51066 ms: Scavenge 1019.7 (1043.1) -> 1018.3 (1047.6) MB, 3.2 / 0.0 ms  (average mu = 0.263, current mu = 0.204) allocation failure


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

馃實 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / 鈻� \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.1.0
Node: 16.13.0
Package Manager: npm 8.1.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.0
@angular-devkit/build-angular   13.1.0
@angular-devkit/core            13.1.0
@angular-devkit/schematics      13.1.0
@schematics/angular             13.1.0
rxjs                            7.4.0
typescript                      4.5.3
webpack                         5.65.0

Anything else relevant?

I am making use of tailwindcss 3 with JIT. As can be seen in the error message, I have a heapsnapshot of a failed ng serve with NODE_OPTIONS=--max_old_space_size=1024. This is a bit big to share easily (1.4G), so I'd like some advice on how best to disclose this.

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

      X Tutup