Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory
I am getting this below error although I have a total of 4000 Unit Test Cases (test suits)
and my test command is
ng test --codeCoverage=true --progress=true --source-map=true
ERROR
<--- Last few GCs ---> [17161:0x3436ed0] 77543 ms: Mark-sweep 1339.8 (1441.9) -> 1330.0 (1444.4) MB, 508.5 / 0.0 ms (average mu = 0.158, current mu = 0.052) allocation failure scavenge might not succeed [17161:0x3436ed0] 78097 ms: Mark-sweep 1343.0 (1444.4) -> 1333.4 (1447.4) MB, 519.5 / 0.0 ms (average mu = 0.111, current mu = 0.062) allocation failure scavenge might not succeed <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 0x3fba773dc01d] Security context: 0x29a82bb1e549 <JSObject> 1: DoJoin(aka DoJoin) [0x29a82bb05cf1] [native array.js:~87] [pc=0x3fba78f8f650](this=0x0098de9026f1 <undefined>,l=0x31b59bcae201 <JSArray[12]>,m=12,A=0x0098de9028c9 <true>,w=0x22fcce42b051 <String[1]: />,v=0x0098de9029a1 <false>) 2: Join(aka Join) [0x29a82bb05d41] [native array.js:~112] [pc=0x3fba773f4c38](this=0x0098de9026f1 <undefined>,l=0x31b59bc... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x8c02c0 node::Abort() [ng test --codeCoverage=true --progress=true --source-map=true] 2: 0x8c030c [ng test --codeCoverage=true --progress=true --source-map=true] 3: 0xad15de v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng test --codeCoverage=true --progress=true --source-map=true] 4: 0xad1814 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng test --codeCoverage=true --progress=true --source-map=true] 5: 0xebe752 [ng test --codeCoverage=true --progress=true --source-map=true] 6: 0xebe858 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [ng test --codeCoverage=true --progress=true --source-map=true] 7: 0xeca982 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng test --codeCoverage=true --progress=true --source-map=true] 8: 0xecb2b4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng test --codeCoverage=true --progress=true --source-map=true] 9: 0xecdf21 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [ng test --codeCoverage=true --progress=true --source-map=true] 10: 0xe962a5 [ng test --codeCoverage=true --progress=true --source-map=true] 11: 0xe9dc0b v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [ng test --codeCoverage=true --progress=true --source-map=true] 12: 0x118c1e8 v8::internal::Runtime_StringBuilderJoin(int, v8::internal::Object**, v8::internal::Isolate*) [ng test --codeCoverage=true --progress=true --source-map=true] 13: 0x3fba773dc01d Aborted (core dumped)
You can run the following command in terminal to increase the heap memory.
export NODE_OPTIONS="--max-old-space-size=8192"