# Build android --prod causing heap out of memory error

**URL:** <https://forum.ionicframework.com/t/build-android-prod-causing-heap-out-of-memory-error/144628>\
**Category:** ionic-v3\
**Created:** [October 15, 2018, 9:58pm UTC](https://forum.ionicframework.com/t/build-android-prod-causing-heap-out-of-memory-error/144628 "2018-10-15T21:58:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![obinnae](https://avatars.discourse-cdn.com/v4/letter/o/a183cd/32.png) [@obinnae](https://forum.ionicframework.com/u/obinnae)\
**Post date:** [October 15, 2018, 9:58pm UTC](https://forum.ionicframework.com/t/build-android-prod-causing-heap-out-of-memory-error/144628/1 "2018-10-15T21:58:48Z")

</div>

Running the following code in Ionic 3 app …

```auto
ionic cordova build android --prod --release

```

causes the following “Allocation failed - JavaScript heap out of memory” error

```auto
[16:47:09] copy finished in 29.74 s

<--- Last few GCs --->

[918:0x103000000] 158841 ms: Mark-sweep 1403.4 (1480.6) -> 1403.4 (1455.1) MB, 3368.9 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 3369 ms) last resort GC in old space requested
[918:0x103000000] 162589 ms: Mark-sweep 1403.4 (1455.1) -> 1403.4 (1455.1) MB, 3748.2 / 0.0 ms last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x18f124a25ee1 <JSObject>
    1: setEmitFlags [/Users/obi/Projects/Mobile/MyApp/node_modules/typescript/lib/typescript.js:~49349] [pc=0x28ed3af9bb4b](this=0x18f12c4d0991 <Object map = 0x18f12fc2a269>,node=0x18f1576b6fb1 <IdentifierObject map = 0x18f195590e29>,emitFlags=16777216)
    3: createEntityNameFromSymbolChain(aka createEntityNameFromSymbolChain) [/Users/obi/Projects/Mobile/MyApp/node_modules/types...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
 5: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
 6: 0x28ed3a90463d
 7: 0x28ed3af9bb4b
Abort trap: 6

```

I’ve tried all the solutions I found in this forum (including adding `--max-old-space-size=4096`) but no luck. I’ve been Googling till kingdom come, but still no luck!

I can’t submit it to the Play Store until it’s resolved.

Any suggestions? Thanks.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:13pm UTC](https://forum.ionicframework.com/t/build-android-prod-causing-heap-out-of-memory-error/144628/2 "2021-07-19T21:13:14Z")

</div>

Closed on July 19, 2021, 9:13pm UTC


