Github actions fails: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Viewed 17

I keep getting an out of memory error when building my library files. This issue was resolved in my local environment by running this command export NODE_OPTIONS="--max-old-space-size=8192".

However, no matter how much I increase the --max-old-space-size in Github workflows file, nothing worked there, it continues to build particular components and then fails with this error:


<--- Last few GCs --->

[3238:0x62dbb30]   103974 ms: Scavenge (reduce) 2038.5 (2082.4) -> 2038.3 (2083.4) MB, 4.0 / 0.0 ms  (average mu = 0.080, current mu = 0.002) allocation failure 
[3238:0x62dbb30]   105675 ms: Mark-sweep (reduce) 2039.2 (2083.4) -> 2036.6 (2083.1) MB, 1697.7 / 0.0 ms  (average mu = 0.054, current mu = 0.014) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa89e60 node::Abort() [node]
 2: 0x9ade29 node::FatalError(char const*, char const*) [node]
 3: 0xc7583e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xc75bb7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xe3f6d5  [node]
 6: 0xe4027c  [node]
 7: 0xe4dc0b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 8: 0xe5190c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0xe157da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x116d4ab v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x15045f9  [node]
Aborted (core dumped)

The workflow file: build.yml

name: Build

on:
  push:
    tags: 
      - "v*"

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [15.x]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: export NODE_OPTIONS="--max-old-space-size=16384" # tried to increase it more but all fails
      - run: npm run build
1 Answers

The issue was resolved by changing the node-version to 14.x.

Related