Irgendw Pointer
Irgendw Pointer

Reputation: 1820

Build Angular App on Rasperry Pi causes Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I have written an Angular App for my own usage. I want to run it on my Rasperry Pi 3+. The app runs on my Linux Mint 19.3 environment w/out any issues. But on Rasppery I do get errors. When I run the code the following applies:

10% building 3/3 modules 0 activeℹ 「wds」: Project is running at http://localhost:4200/webpack-dev-server/ ℹ 「wds」: webpack output is served from / ℹ 「wds」: 404s will fallback to //index.html 93% ...k asset optimization SourceMapDevToolPlugin vendor.js generate SourceMap <--- Last few GCs --->

[5260:0x340db28] 104721 ms: Mark-sweep 225.2 (231.7) -> 224.8 (231.7) MB, 1080.3 / 0.2 ms (average mu = 0.081, current mu = 0.028) allocation failure scavenge might not succeed [5260:0x340db28]
106073 ms: Mark-sweep 225.2 (231.7) -> 224.9 (231.7) MB, 1335.5 / 0.2 ms (average mu = 0.045, current mu = 0.012) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 0xe52060] Security context: 0x2b20e225 <JSObject>
1: /* anonymous */ [0x57fd43c5] [/home/pi/has/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:~342]

[pc=0x41af13e0](this=0x3e542281 ,0x6e193fcd ,0x6e3d45f9 ) 2: SourceNode_walk [0x3d55ea81] [/home/pi/has/node_modules/webpack-...

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

Writing Node.js report to file: report.20200102.193729.5260.0.001.json Node.js report completed

Angular version

Angular CLI: 8.3.21
Node: 12.14.0
OS: linux arm
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.21
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.3.21
@angular-devkit/schematics        8.3.21
@angular/cdk                      8.2.3
@angular/cli                      8.3.21
@angular/material                 8.2.3
@ngtools/webpack                  8.3.21
@schematics/angular               8.3.21
@schematics/update                0.803.21
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

I've tried node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build but this brought the same issue but the error message FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.

The full output of the error log:

{
  "header": {
    "reportVersion": 1,
    "event": "Allocation failed - JavaScript heap out of memory",
    "trigger": "FatalError",
    "filename": "report.20200102.193729.5260.0.001.json",
    "dumpEventTime": "2020-01-02T19:37:29Z",
    "dumpEventTimeStamp": "1577990249360",
    "processId": 5260,
    "cwd": "/home/pi/has",
    "commandLine": [
      "node",
      "/usr/local/bin/ng",
      "serve"
    ],
    "nodejsVersion": "v12.14.0",
    "glibcVersionRuntime": "2.24",
    "glibcVersionCompiler": "2.24",
    "wordSize": 32,
    "arch": "arm",
    "platform": "linux",
    "componentVersions": {
      "node": "12.14.0",
      "v8": "7.7.299.13-node.16",
      "uv": "1.33.1",
      "zlib": "1.2.11",
      "brotli": "1.0.7",
      "ares": "1.15.0",
      "modules": "72",
      "nghttp2": "1.39.2",
      "napi": "5",
      "llhttp": "1.1.4",
      "http_parser": "2.8.0",
      "openssl": "1.1.1d",
      "cldr": "35.1",
      "icu": "64.2",
      "tz": "2019c",
      "unicode": "12.1"
    },
    "release": {
      "name": "node",
      "lts": "Erbium",
      "headersUrl": "https://nodejs.org/download/release/v12.14.0/node-v12.14.0-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v12.14.0/node-v12.14.0.tar.gz"
    },
    "osName": "Linux",
    "osRelease": "4.19.66-v7+",
    "osVersion": "#1253 SMP Thu Aug 15 11:49:46 BST 2019",
    "osMachine": "armv7l",
    "cpus": [
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 3946500,
        "nice": 0,
        "sys": 523700,
        "idle": 286109100,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 4518000,
        "nice": 0,
        "sys": 503400,
        "idle": 295956800,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 5118000,
        "nice": 0,
        "sys": 337100,
        "idle": 300228000,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 4341100,
        "nice": 0,
        "sys": 402500,
        "idle": 298362700,
        "irq": 0
      }
    ],
    "networkInterfaces": [
      {
        "name": "lo",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "127.0.0.1",
        "netmask": "255.0.0.0",
        "family": "IPv4"
      },
      {
        "name": "wlan0",
        "internal": false,
        "mac": "b8:27:eb:4c:2c:35",
        "address": "192.168.0.102",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      },
      {
        "name": "lo",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "::1",
        "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
        "family": "IPv6",
        "scopeid": 0
      },
      {
        "name": "wlan0",
        "internal": false,
        "mac": "b8:27:eb:4c:2c:35",
        "address": "fe80::6d47:a3cb:9456:52b8",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 3
      }
    ],
    "host": "raspberrypi"
  },
  "javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ]
  },
  "nativeStack": [
  ],
  "javascriptHeap": {
    "totalMemory": 244576256,
    "totalCommittedMemory": 242602288,
    "usedMemory": 235924732,
    "availableMemory": 6366124,
    "memoryLimit": 248512512,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 262144,
        "committedMemory": 22240,
        "capacity": 262008,
        "used": 22104,
        "available": 239904
      },
      "new_space": {
        "memorySize": 2097152,
        "committedMemory": 608500,
        "capacity": 1048032,
        "used": 83428,
        "available": 964604
      },
      "old_space": {
        "memorySize": 192204800,
        "committedMemory": 192198140,
        "capacity": 189165284,
        "used": 188987956,
        "available": 177328
      },
      "code_space": {
        "memorySize": 2523136,
        "committedMemory": 2284512,
        "capacity": 2067776,
        "used": 2067776,
        "available": 0
      },
      "map_space": {
        "memorySize": 4198400,
        "committedMemory": 4198272,
        "capacity": 1685120,
        "used": 1685120,
        "available": 0
      },
      "large_object_space": {
        "memorySize": 42668032,
        "committedMemory": 42668032,
        "capacity": 42532684,
        "used": 42532684,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 622592,
        "committedMemory": 622592,
        "capacity": 545664,
        "used": 545664,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 1048032,
        "used": 0,
        "available": 1048032
      }
    }
  },
  "resourceUsage": {
    "userCpuSeconds": 196.452,
    "kernelCpuSeconds": 2.65665,
    "cpuConsumptionPercent": 186.083,
    "maxRss": 301801472,
    "pageFaults": {
      "IORequired": 0,
      "IONotRequired": 150376
    },
    "fsActivity": {
      "reads": 2880,
      "writes": 0
    }
  },
  "uvthreadResourceUsage": {
    "userCpuSeconds": 99.4757,
    "kernelCpuSeconds": 1.90042,
    "cpuConsumptionPercent": 94.7441,
    "fsActivity": {
      "reads": 2880,
      "writes": 0
    }
  },
  "libuv": [
  ],
  "environmentVariables": {
    "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",
    "LANG": "de_AT.UTF-8",
    "NO_AT_BRIDGE": "1",
    "TERM": "xterm-256color",
    "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "MAIL": "/var/mail/root",
    "LOGNAME": "root",
    "USER": "root",
    "USERNAME": "root",
    "HOME": "/root",
    "SHELL": "/bin/bash",
    "SUDO_COMMAND": "/usr/local/bin/ng serve",
    "SUDO_USER": "pi",
    "SUDO_UID": "1000",
    "SUDO_GID": "1000",
    "WEBPACK_DEV_SERVER": "true"
  },
  "userLimits": {
    "core_file_size_blocks": {
      "soft": 0,
      "hard": "unlimited"
    },
    "data_seg_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "file_size_blocks": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_locked_memory_bytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_memory_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "open_files": {
      "soft": 1048576,
      "hard": 1048576
    },
    "stack_size_bytes": {
      "soft": 8388608,
      "hard": "unlimited"
    },
    "cpu_time_seconds": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_user_processes": {
      "soft": 7336,
      "hard": 7336
    },
    "virtual_memory_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    }
  },
  "sharedObjects": [
    "linux-vdso.so.1",
    "/usr/lib/arm-linux-gnueabihf/libarmmem.so",
    "/lib/arm-linux-gnueabihf/libdl.so.2",
    "/usr/lib/arm-linux-gnueabihf/libstdc++.so.6",
    "/lib/arm-linux-gnueabihf/libm.so.6",
    "/lib/arm-linux-gnueabihf/libgcc_s.so.1",
    "/lib/arm-linux-gnueabihf/libpthread.so.0",
    "/lib/arm-linux-gnueabihf/libc.so.6",
    "/lib/ld-linux-armhf.so.3",
    "/lib/arm-linux-gnueabihf/libnss_files.so.2",
    "/lib/arm-linux-gnueabihf/libnss_mdns4_minimal.so.2",
    "/lib/arm-linux-gnueabihf/libnss_dns.so.2",
    "/lib/arm-linux-gnueabihf/libresolv.so.2"
  ]
}

Any idea what I need to configure on Rasperry to get the app runable?

Upvotes: 2

Views: 937

Answers (1)

Irgendw Pointer
Irgendw Pointer

Reputation: 1820

ng serve --sourceMap=false

solved the issue, because no sourceMap is used.

Upvotes: 1

Related Questions