-
Notifications
You must be signed in to change notification settings - Fork 311
JavaScript heap out of memory !!!!!! #1467
Comments
same here. so many complaints about this and still no real solution: #1422 the only suggestions I came across was to remove --prod and use --aot --uglifyjs --minifyjs --minifycss --release instead which does not have the same effect as --prod as far as loading time of startup is concerned and to downgrade firebase to 4.12.1 which is unacceptable since version 4.13.0 has a critical bug fix. |
Same here... No solution yet? |
1 month into the issue, no solutions. |
Same issue here, but without using Firebase. It kinda scares me that all of a sudden you are unable to build your large app and have to spend hours figuring out how to build for a new app release. Hope this is being solved soon. Can confirm --prod triggers the memory error, with --aot --uglifyjs --minifyjs --minifycss --release as suggested by @mydoal gave no memory problems, but a much larger app instead. |
I've found a solution which was pointed out in an old message on the forum: https://forum.ionicframework.com/t/3-7-0-ios-build-with-prod-not-working/107061/24 Open Change the first line from: I tried values 1024 and 2048, but for my relatively large app I needed 4096. Now I am able to run |
Found a better solution, to specify NODE env variable before the build: Credits to: https://stackoverflow.com/a/48895989/4919972 |
@kirillgroshkov Nice find! For future readers, take the warning from the stackoverflow comments into account when applying the export NODE_OPTIONS:
|
I'm facing the same issue here, and the build fails even after using the "max-old-space-size" option. |
Set NODE_OPTIONS environment variable with value as --max-old-space-size=4096 in windows os to solve this issue. |
did not work for me |
only add "@firebase/database": "0.2.1", for your package.json, and works. |
I have seen these errors happen frequently throughout the different Ionic 4 beta releases. Typically I install a more up to date version of the @angular-devkit/build-optimizer. As I write this, we are on 0.11.4 as being the newest version. When I updated this I had to update the webpack.config.js to remove the purify plugin per angular/angular-cli#11370 After this I was able to do a prod build once again, so far it seems like updating the build-optimized that is used by the ionic scripts always saves me when I have these OOM issues with Ionic builds. |
@jayordway When you say you needed to update the webpack.config.js, how did you do so? |
I had the same issue. My problem was, that I have imported the whole firebase library, instead of only the components I needed. So, if you get the following warning:
You have to change your import: Initialize your firebase:
Using firestore, auth, ...:
and if the warning is gone, you should be able to build with prod flag! |
In Packages scripts add |
Short description of the problem:
Ionic:
ionic (Ionic CLI) : 4.1.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 2.2.0
@ionic/app-scripts : 3.1.11
Cordova:
cordova (Cordova CLI) : 6.5.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
System:
NodeJS : v10.8.0 (/usr/local/Cellar/node/10.8.0/bin/node)
npm : 6.2.0
OS : macOS High Sierra
Environment:
ANDROID_HOME : not set
description:
over 100 pages.
when exec :
ionic-app-scripts build --max_old_space_size=8192 --aot --optimizeJs --minifyjs --minifycss
error:
[12:04:24] ionic-app-scripts 3.1.11
[12:04:24] build dev started ...
[12:04:24] clean started ...
[12:04:24] clean finished in 3 ms
[12:04:24] copy started ...
[12:04:25] copy finished in 287 ms
[12:04:25] deeplinks started ...
[12:04:25] deeplinks finished in 13 ms
[12:04:25] ngc started ...
[12:06:37] ngc finished in 132.50 s
[12:06:37] preprocess started ...
[12:06:37] preprocess finished in less than 1 ms
[12:06:37] webpack started ...
<--- Last few GCs --->
[3274:0x104802a00] 1762980 ms: Mark-sweep 9571.9 (10413.5) -> 9571.3 (10372.5) MB, 662.2 / 0.0 ms (average mu = 0.199, current mu = 0.165) allocation failure GC in old space requested
[3274:0x104802a00] 1763040 ms: Scavenge 9586.3 (10386.8) -> 9585.4 (10386.8) MB, 11.7 / 0.0 ms (average mu = 0.199, current mu = 0.165) allocation failure
[3274:0x104802a00] 1763094 ms: Scavenge 9600.8 (10401.5) -> 9600.0 (10402.0) MB, 12.0 / 0.0 ms (average mu = 0.199, current mu = 0.165) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2b02501e789
1: DoJoin(aka DoJoin) [0x2b025005ab9] [native array.js:~87] [pc=0x23bb22ee00e3](this=0x2b059f822e1 ,l=0x2b147884811 <JSArray[653]>,m=653,A=0x2b059f82381 ,w=0x2b059fb05f1 <String[1]: >,v=0x2b059f823f1 )
2: Join(aka Join) [0x2b025005b09] [native array.js:~112] [pc=0x23bb22eea014](this=0x2b059f822e1 ,l=0x2b147884811 <J...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x100038460 node::Abort() [/usr/local/bin/node]
2: 0x1000385ea node::FatalTryCatch::~FatalTryCatch() [/usr/local/bin/node]
3: 0x1001881eb v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x10018818d v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x100461052 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/bin/node]
6: 0x100462cf5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
7: 0x1004603b7 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x10045f308 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x100467507 v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x100446f64 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
11: 0x100680b41 v8::internal::Runtime_StringBuilderJoin(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x23bb22e041bd
13: 0x23bb22ee00e3
14: 0x23bb22eea014
15: 0x23bb2505b7e9
16: 0x23bb24bb31b0
17: 0x23bb2588664f
18: 0x23bb22e0c5a3
19: 0x23bb22efb84c
20: 0x23bb22e13a09
The text was updated successfully, but these errors were encountered: