# HTML5 Cannot enlarge memory arrays

**URL:** <https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213>\
**Category:** Platform & Builds\
**Tags:** HTML5, unreal-engine, crash, question, CPP\
**Created:** [December 14, 2017, 6:00am UTC](https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213 "2017-12-14T06:00:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReduxRus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ReduxRus](https://forums.unrealengine.com/u/ReduxRus)\
**Post date:** [December 14, 2017, 6:00am UTC](https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213/1 "2017-12-14T06:00:34Z")

</div>

HTML5 build always crash if add this:

**UE\_LOG(LogTemp, Warning, TEXT(“Тест”));**

or any utf text

```
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 1342177280, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 

uncaught exception: abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 1342177280, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ") at jsStackTrace@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:18997
stackTrace@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:19168
abort@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:1022946
abortOnCannotGrowMemory@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:21045
_sbrk@http://localhost:8000//HTML5_UTF.html:38613163:1
_malloc@http://localhost:8000//HTML5_UTF.html:38459714:1
__ZN4FMsg13Logf_InternalEPKciRK5FNameN13ELogVerbosity4TypeEPKwz [FMsg::Logf_Internal(char const*, int, FName const&, ELogVerbosity::Type, wchar_t const*, ...)]@http://localhost:8000//HTML5_UTF.html:922361:1
__ZN19AHTML5_UTFCharacter11MoveForwardEf [AHTML5_UTFCharacter::MoveForward(float)]@http://localhost:8000//HTML5_UTF.html:784133:1
__ZN21TMemberFunctionCallerI19AHTML5_UTFCharacterMS0_FvfEEclIJRfEEEDTclpmdtdefpT3ObjdtdefpT9MemFunPtrspcl7ForwardIT_Efp_EEEDpOS6_@http://localhost:8000//HTML5_UTF.html:790337:1
__ZNK16UE4Tuple_Private10TTupleImplI16TIntegerSequenceIjJEEJEE10ApplyAfterI21TMemberFunctionCallerI19AHTML5_UTFCharacterMS6_FvfEEJRfEEEDcOT_DpOT0_@http://localhost:8000//HTML5_UTF.html:790259:1
__ZNK34TBaseUObjectMethodDelegateInstanceILb0E19AHTML5_UTFCharacterF12TTypeWrapperIvEfEJEE7ExecuteEf [TBaseUObjectMethodDelegateInstance<false, AHTML5_UTFCharacter, TTypeWrapper<void> (float)>::Execute(float) const]@http://localhost:8000//HTML5_UTF.html:790210:1
__ZNK28FInputGestureUnifiedDelegate7ExecuteEf [FInputGestureUnifiedDelegate::Execute(float) const]@http://localhost:8000//HTML5_UTF.html:10330987:1
__ZN12UPlayerInput17ProcessInputStackERK6TArrayIP15UInputComponent17FDefaultAllocatorEfb [UPlayerInput::ProcessInputStack(TArray<UInputComponent*, FDefaultAllocator> const&, float, bool)]@http://localhost:8000//HTML5_UTF.html:10323655:1
__ZN17APlayerController18ProcessPlayerInputEfb [APlayerController::ProcessPlayerInput(float, bool)]@http://localhost:8000//HTML5_UTF.html:8886423:1
__ZN17APlayerController15TickPlayerInputEfb [APlayerController::TickPlayerInput(float, bool)]@http://localhost:8000//HTML5_UTF.html:10441467:1
__ZN17APlayerController10PlayerTickEf [APlayerController::PlayerTick(float)]@http://localhost:8000//HTML5_UTF.html:8874988:1
__ZN17APlayerController9TickActorEf10ELevelTickR18FActorTickFunction [APlayerController::TickActor(float, ELevelTick, FActorTickFunction&)]@http://localhost:8000//HTML5_UTF.html:8847942:1
__ZN18FActorTickFunction11ExecuteTickEf10ELevelTickN13ENamedThreads4TypeERK12TRefCountPtrI11FGraphEventE [FActorTickFunction::ExecuteTick(float, ELevelTick, ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&)]@http://localhost:8000//HTML5_UTF.html:4897440:1
__ZN17FTickFunctionTask6DoTaskEN13ENamedThreads4TypeERK12TRefCountPtrI11FGraphEventE [FTickFunctionTask::DoTask(ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&)]@http://localhost:8000//HTML5_UTF.html:4644528:1
__ZN10TGraphTaskI17FTickFunctionTaskE11ExecuteTaskER6TArrayIP14FBaseGraphTask17FDefaultAllocatorEN13ENamedThreads4TypeE [TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask*, FDefaultAllocator>&, ENamedThreads::Type)]@http://localhost:8000//HTML5_UTF.html:4643898:1
__ZN16FNamedTaskThread23ProcessTasksNamedThreadEib [FNamedTaskThread::ProcessTasksNamedThread(int, bool)]@http://localhost:8000//HTML5_UTF.html:2069636:1
__ZN16FNamedTaskThread21ProcessTasksUntilQuitEi [FNamedTaskThread::ProcessTasksUntilQuit(int)]@http://localhost:8000//HTML5_UTF.html:2067215:1
__ZN24FTaskGraphImplementation31ProcessThreadUntilRequestReturnEN13ENamedThreads4TypeE [FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type)]@http://localhost:8000//HTML5_UTF.html:2076421:1
__ZN24FTaskGraphImplementation22WaitUntilTasksCompleteERK6TArrayI12TRefCountPtrI11FGraphEventE16TInlineAllocatorILj4E17FDefaultAllocatorEEN13ENamedThreads4TypeE [FTaskGraphImplementation::WaitUntilTasksComplete(TArray<TRefCountPtr<FGraphEvent>, TInlineAllocator<4u, FDefaultAllocator> > const&, ENamedThreads::Type)]@http://localhost:8000//HTML5_UTF.html:2077042:1
__ZN18FTickTaskSequencer16ReleaseTickGroupE13ETickingGroupb [FTickTaskSequencer::ReleaseTickGroup(ETickingGroup, bool)]@http://localhost:8000//HTML5_UTF.html:4633338:1
__ZN16FTickTaskManager12RunTickGroupE13ETickingGroupb [FTickTaskManager::RunTickGroup(ETickingGroup, bool)]@http://localhost:8000//HTML5_UTF.html:4627489:1
__ZN6UWorld12RunTickGroupE13ETickingGroupb [UWorld::RunTickGroup(ETickingGroup, bool)]@http://localhost:8000//HTML5_UTF.html:15416508:1
__ZN6UWorld4TickE10ELevelTickf [UWorld::Tick(ELevelTick, float)]@http://localhost:8000//HTML5_UTF.html:15375045:1
__ZN11UGameEngine4TickEfb [UGameEngine::Tick(float, bool)]@http://localhost:8000//HTML5_UTF.html:15265683:1
__ZN11FEngineLoop4TickEv [FEngineLoop::Tick()]@http://localhost:8000//HTML5_UTF.html:830301:1
__Z10HTML5_Tickv [HTML5_Tick()]@http://localhost:8000//HTML5_UTF.html:868771:1
dynCall_v@http://localhost:8000//HTML5_UTF.html:38616394:1
Module.dynCall_v@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:972015
browserIterationFunc@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:116441
runIter@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:119552
Browser_mainLoop_runner@blob:http://localhost:8000/2d919216-9b26-4180-ac8b-61c15bc8d09e:1:117978
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f0fea7ad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f0fea7ad](https://forums.unrealengine.com/u/anonymous_user_f0fea7ad)\
**Post date:** [January 18, 2018, 4:06pm UTC](https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213/2 "2018-01-18T16:06:31Z")

</div>

This kind of crash looks familiar. I believe this was something that was a “double bug” in both UE4 and Emscripten, with UE4 not expecting default locale of Emscripten being what it was, and triggering an infinite memory reallocation loop that would crash like that.

This change [default\_lang\_is\_utf8 by juj · Pull Request #5500 · emscripten-core/emscripten · GitHub](https://github.com/kripken/emscripten/pull/5500) should fix it, but I think UE4 has not yet migrated to use that version. You could try finding this line [default\_lang\_is\_utf8 by juj · Pull Request #5500 · emscripten-core/emscripten · GitHub](https://github.com/kripken/emscripten/pull/5500/files#diff-94dc100be52b26c684387d19d991a887R635) in your generated .js export, and changing it as shown to see if that fixes it. If not, then it’s possible that there was something related to this that was being fixed in Emscripten, so once UE4 updates to a newer version of Emscripten, it’s possible that this will get fixed.

---

<div class="post-metadata">

**Author:** ![DesertEagle\_PWN](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DesertEagle\_PWN](https://forums.unrealengine.com/u/DesertEagle_PWN)\
**Post date:** [November 28, 2018, 12:50am UTC](https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213/3 "2018-11-28T00:50:04Z")

</div>

I am also having this issue. Thanks for the insight @juj. Unfortunately changing the LANG ENV var inside the exported .js from “C” to “C.UTF-8” didn’t change anything and I’m still getting the  
`Uncaught abort("Cannot enlarge memory arrays. `  
message in 4.21.1 Has anything else been changed since January that you’re aware of? Any workarounds for a project with this issue?

---

<div class="post-metadata">

**Author:** ![LuisAlaguna](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luisalaguna/32/570408_2.png) [@LuisAlaguna](https://forums.unrealengine.com/u/LuisAlaguna)\
**Post date:** [May 9, 2019, 9:50am UTC](https://forums.unrealengine.com/t/html5-cannot-enlarge-memory-arrays/412213/4 "2019-05-09T09:50:49Z")

</div>

Did you try this?  
[https://forums.unrealengine.com/development-discussion/html5-development/78152-html5-uncaught-abort-cannot-enlarge-memory-arrays](https://forums.unrealengine.com/development-discussion/html5-development/78152-html5-uncaught-abort-cannot-enlarge-memory-arrays)
