Sungtt

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

Node

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

sungtt 2022. 11. 14. 11:47

메모리가 부족하여 생긴 오류

err: <--- Last few GCs --->
err: 
err: [13452:0x5087040]    81367 ms: Mark-sweep 475.7 (492.8) -> 472.0 (493.1) MB, 1085.3 / 0.1 ms  (average mu = 0.128, current mu = 0.024) allocation failure scavenge might not succeed
err: [13452:0x5087040]    82455 ms: Mark-sweep 476.2 (493.1) -> 472.2 (493.3) MB, 1046.5 / 0.0 ms  (average mu = 0.085, current mu = 0.038) allocation failure scavenge might not succeed
err: 
err: 
err: <--- JS stacktrace --->
err: 
err: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
err:  1: 0xb02930 node::Abort() [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  2: 0xa18149 node::FatalError(char const*, char const*) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  3: 0xcdd16e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  4: 0xcdd4e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  5: 0xe94b55  [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  6: 0xe95636  [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  7: 0xea3b5e  [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  8: 0xea45a0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err:  9: 0xea751e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err: 10: 0xe68a5a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err: 11: 0x11e17c6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/home/***/.nvm/versions/node/v16.17.0/bin/node]
err: 12: 0x15d5439  [/home/***/.nvm/versions/node/v16.17.0/bin/node]
20***/11/14 00:46:43 Process exited with status 1

 

해결방법은 메모리 누수를 해결하거나,

노드 기본 메모리를 증가시키는것.

https://stackoverflow.com/questions/72785021/typescript-server-issue-fatal-error-ineffective-mark-compacts-near-heap-limit-a

 

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

in my CRA project each single time I ran it I faced this error in my console. I think it is due to typescript server. Is there a way to solve it ? 99% done plugins webpack-hot-middlewarewebpack built

stackoverflow.com

 

나는 커맨드라인에 아래를 실행하였다.

export NODE_OPTIONS="--max-old-space-size=812"

오히려 적용은 안되고, 오류가 생겼다.

 

아래처럼 소스맵생성을 하지않는것으로 설정하여 우선 빌드는 완료하였다.

https://stackoverflow.com/questions/55613789/how-to-fix-fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-fa

 

How to fix "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error

I'm trying to deploy a reactjs application to heroku. While compiling assets, the build fails and produces this error: -----> Ruby app detected -----> Compiling Ruby/Rails -----> Using Ruby

stackoverflow.com

 

.env 파일에 아래 코드추가

서버는 .env.local.production 를 읽어와 빌드하기때문에 해당 파일에 추가

GENERATE_SOURCEMAP=false
Comments