0

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
  • Maybe this can help you https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-javas – Neeraj Kumar Sep 18 '22 at 08:35
  • 1
    Thanks @NeerajKumar for the reply, I actually resolved it by downgrading the node version to `14.x` instead of `15.x`. I got inspired by this thread https://github.com/nodejs/help/issues/3226 – Sheikhah Maasher Sep 19 '22 at 09:25

2 Answers2

0

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

0

Make export NODE_OPTIONS="--max-old-space-size=4096" part of the same run block.

  name: Build
    run: |
      export NODE_OPTIONS="--max-old-space-size=4096"
      npm run build

See https://github.com/actions/runner-images/issues/70 for more ideas and discussions

Klapsa2503
  • 829
  • 10
  • 33