failed to asynchronously prepare wasm: Error: Out of executable memory

1,779 views
Skip to first unread message

Александр Гурьянов

unread,
Jul 30, 2018, 7:07:34 AM7/30/18
to emscripte...@googlegroups.com
Hi guys. I faced this problem "failed to asynchronously prepare wasm:
Error: Out of executable memory" with one of my project.

wasm binary size is 5.1 Mb

This error present on iphone 8, both in Chrome and Safari. This error
is not stable, it is happen ~one time in five runs. And I just reload
the page and game start working.

This error occurs before 'onRutimeInitialized' is called. I use
ArrayBuffer as wasmBinary, because I can't change mime type to
application/wasm on my backend.

Asm.js version works fine.

I will try to reduce size of wasm binary, but it does not looks very
big for me. Any ideas?

Thanks.

Александр Гурьянов

unread,
Jul 30, 2018, 10:22:37 AM7/30/18
to emscripte...@googlegroups.com
failed to asynchronously prepare wasm: Error: Out of executable memory
in function at index 11802
[native code]:1 Unhandled Promise Rejection: Error: Out of executable
memory in function at index 11802(anonymous function) @ [native
code]:1promiseReactionJob @ [native code]:1
пн, 30 июл. 2018 г. в 13:07, Александр Гурьянов <caii...@gmail.com>:

Alon Zakai

unread,
Jul 30, 2018, 9:57:25 PM7/30/18
to emscripten-discuss
How big is TOTAL_MEMORY in this project? It could be either the binary size itself, or the memory size, that it doesn't have enough memory for.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Александр Гурьянов

unread,
Jul 31, 2018, 9:03:19 AM7/31/18
to emscripte...@googlegroups.com
After playing a lot with memory, I almost sure that problem is not
related to TOTAL_MEMORY. Even with 16Mb I have this bug sometimes. I
believe that it is related to
https://github.com/kripken/emscripten/issues/6042. From time to time
I've have this error:
12381ms | exception thrown: Error: Out of bounds memory access
(evaluating 'Module["asm"]["_main"].apply(null,
arguments)'),<?>.wasm-function[__ZN4game18Scene_SplashScreen4initEv]@[wasm
code]
<?>.wasm-function[__ZN4game18Scene_SplashScreen6createEv]@[wasm code]
<?>.wasm-function[__ZN4game5CMain4initEv]@[wasm code]
<?>.wasm-function[__ZN4game11AppDelegate29applicationDidFinishLaunchingEv]@[wasm
code]
<?>.wasm-function[__ZN7cocos2d11Application3runEv]@[wasm code]
<?>.wasm-function[_main]@[wasm code]
wasm-stub@[wasm code]
_main@[native code]

callMain
http://192.168.1.37/gamepix-loader.js:456:30
fn@http://192.168.1.37/gamepix-loader.js:465:32

This happens only on ios, and only on mobile. Asm.js works fine.
I think to add ios into blacklist for wasm, because this bug is
completely random. Test from Brion
(https://github.com/brion/min-wasm-fail/blob/master/min-wasm-fail.js)
always succeed.
вт, 31 июл. 2018 г. в 3:57, Alon Zakai <alon...@gmail.com>:
>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Wanghb Wang

unread,
Mar 7, 2019, 10:10:06 PM3/7/19
to emscripten-discuss
hi caiiiycuk
I have the same question with iphone/ipad
Do you fix the question?
在 2018年7月31日星期二 UTC+8下午9:03:19,caiiiycuk写道:
>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Александр Гурьянов

unread,
Mar 8, 2019, 12:53:45 AM3/8/19
to emscripte...@googlegroups.com
Hi. Only reducing wasm size helps for me. From my experience if wasm size is bigger then 3mb (gzipped) you can catch this error. Also somewhere I read that its bug of safari, and it should be fixed starting from12 version
пт, 8 мар. 2019 г., 10:10 Wanghb Wang <wang...@gmail.com>:
>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Wanghb Wang

unread,
Mar 11, 2019, 1:13:37 AM3/11/19
to emscripten-discuss
Did you test your App on safari(12+)?

在 2019年3月8日星期五 UTC+8下午1:53:45,caiiiycuk写道:
>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Александр Гурьянов

unread,
Mar 11, 2019, 2:56:22 AM3/11/19
to emscripte...@googlegroups.com
No, I found way to reduce wasm size, and it works for me.

пн, 11 мар. 2019 г. в 12:13, Wanghb Wang <wang...@gmail.com>:
>>>> >> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>>>> >> For more options, visit https://groups.google.com/d/optout.
>>>> >
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>>>> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Alex St. Louis

unread,
Mar 11, 2019, 10:54:17 AM3/11/19
to emscripte...@googlegroups.com
Curious, how did you find a way to reduce your wasm size? We're bringing games to the web, and any way we can optimize the file sizes would make all the difference.

Александр Гурьянов

unread,
Mar 11, 2019, 11:32:02 AM3/11/19
to emscripte...@googlegroups.com
Nothing special. Just switch to -Oz flag, and drop some 3rd party
libraries. Tools like bloaty is very usefull. In my case I need too
decrese wasm size on really small amount. Anyway I hope that 12+ will
solve this problem forever.

пн, 11 мар. 2019 г. в 21:54, Alex St. Louis <alexs...@digiplaygaming.com>:

Александр Гурьянов

unread,
Mar 11, 2019, 11:38:18 AM3/11/19
to emscripte...@googlegroups.com
I believe, that this is our problem:
https://bugs.webkit.org/show_bug.cgi?id=181723

пн, 11 мар. 2019 г. в 22:31, Александр Гурьянов <caii...@gmail.com>:

Wanghb Wang

unread,
Mar 11, 2019, 9:27:11 PM3/11/19
to emscripten-discuss
The URL said that the problem   is still exists. 
在 2019年3月11日星期一 UTC+8下午11:38:18,caiiiycuk写道:
> >> >>>> >> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> >> >>>> >> For more options, visit https://groups.google.com/d/optout.
> >> >>>> >
> >> >>>> >
> >> >>>> > --
> >> >>>> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> >> >>>> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> >> >>>> > For more options, visit https://groups.google.com/d/optout.
> >> >>>
> >> >>> --
> >> >>> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> >> >>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> >> >>> For more options, visit https://groups.google.com/d/optout.
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> >> > For more options, visit https://groups.google.com/d/optout.
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Александр Гурьянов

unread,
Mar 12, 2019, 12:34:17 AM3/12/19
to emscripte...@googlegroups.com
Okay apologies for not conducting a full review with iOS 12.2!

So TLDR: I would rate this ticket as 99% resolved.

вт, 12 мар. 2019 г. в 08:27, Wanghb Wang <wang...@gmail.com>:
>> > >> >>>> >> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > >> >>>> >> For more options, visit https://groups.google.com/d/optout.
>> > >> >>>> >
>> > >> >>>> >
>> > >> >>>> > --
>> > >> >>>> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>> > >> >>>> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > >> >>>> > For more options, visit https://groups.google.com/d/optout.
>> > >> >>>
>> > >> >>> --
>> > >> >>> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>> > >> >>> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > >> >>> For more options, visit https://groups.google.com/d/optout.
>> > >> >
>> > >> > --
>> > >> > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>> > >> > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > >> > For more options, visit https://groups.google.com/d/optout.
>> > >>
>> > >> --
>> > >> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>> > >> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > >> For more options, visit https://groups.google.com/d/optout.
>> > >
>> > > --
>> > > You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
>> > > To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
>> > > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages