JavaScript heap out of memory
Describe the bug
While build or run my project with create-react-app. It throws js heap out of memory error. yarn build yarn run v1.22.4 $ react-scripts build <--- Last few GCs --->
[3722:0x296ee80] 161055 ms: Scavenge 1383.7 (1423.5) -> 1383.2 (1424.5) MB, 4.3 / 0.0 ms (average mu = 0.109, current mu = 0.036) allocation failure [3722:0x296ee80] 161725 ms: Mark-sweep 1383.9 (1424.5) -> 1383.5 (1424.0) MB, 667.2 / 0.0 ms (average mu = 0.064, current mu = 0.015) allocation failure scavenge might not succeed <--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x1fbb144dbe1d]
1: StubFrame [pc: 0x1fbb144934b0]
Security context: 0x1465dc29e6e9
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x8fa090 node::Abort() [/usr/bin/node] 2: 0x8fa0dc [/usr/bin/node] 3: 0xb0052e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node] 4: 0xb00764 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node] 5: 0xef4c72 [/usr/bin/node] 6: 0xef4d78 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/bin/node] 7: 0xf00e52 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/bin/node] 8: 0xf01784 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node] 9: 0xf043f1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/bin/node] 10: 0xecd874 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/bin/node] 11: 0x116d9fe v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node] 12: 0x1fbb144dbe1d
Did you try recovering your dependencies?
Yes, the issue exists after deleting node_modules folder and reinstalling through yarn
Environment
System: OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver) CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz Binaries: Node: 10.19.0 - /usr/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.13.4 - /usr/local/bin/npm Browsers: Chrome: 80.0.3987.163 Firefox: 75.0 npmPackages: react: ^16.8.6 => 16.13.1 (15.6.2) react-dom: ^16.8.6 => 16.13.1 (15.6.2) react-scripts: 3.0.1 => 3.0.1 npmGlobalPackages: create-react-app: 3.3.0
In my particular environment I allocate more memory in the build script in package.json:
"scripts": {
...
"build": "NODE_OPTIONS=--max_old_space_size=4096 react-scripts build",
...
}
One of the packages I use requires more memory.
I don't know if this exact code will work in your environment but it might point the way to a solution.
In my particular environment I allocate more memory in the build script in package.json:
"scripts": { ... "build": "NODE_OPTIONS=--max_old_space_size=4096 react-scripts build", ... }One of the packages I use requires more memory.
I don't know if this exact code will work in your environment but it might point the way to a solution.
i did that using -max_old_space_size=4096 but error still persist