How to avoid hang-up / "enlarged memory" errors in WebAssembly exports ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Camille Bissuel
:warning: Old Version Published before Godot 3 was released.

Hi dear Godot community,

I’m not a developer (I’m graphic designer and illustrator) and for my current project made with current Godot dev version (3.0 Alpha 2 and more recent commits), I export it with the WebAssembly template.

I experience hang-up (game become unresponsive and music scratch in a loop for a second or more) in Chromium 62, but not in Firefox 57 while changing scenes or loading them.

You can test it here :

I noticed that when the scenes are loading, the output debug console in the browser say it enlarge memory, for example:

**ERROR**: enlarged memory arrays from 16777216 to 33554432, took 27 ms (has ArrayBuffer.transfer? false)
**ERROR**: enlarged memory arrays from 33554432 to 67108864, took 0 ms (has ArrayBuffer.transfer? false)

Interestingly, the debug console is reporting theses errors in Firefox, but it’s not in Chrome…

I tried to optimize my scenes loading with a singleton and autoload: It’s far better but that’s not enough…

So, is there a way to define and increase memory limit, and how (or where in the editor) ?

Thanks a lot for your futures answers, short or long !

:bust_in_silhouette: Reply From: Camille Bissuel

I report an answer by Leon Krause (@eska014) elsewhere :

The enlarged memory ‘errors’ are not really errors, just misreported
debug messages by Emscripten, the software we use to develop the HTML
platform. The time needed to resize memory is usually trivial.
If feasible, I recommend you try simply keeping the scenes loaded at all
times. If that requires too much memory, I suggest using
ResourceLoader.load_interactive() to load a scene step-by-step over
multiple frames.

I finally used the ResourceLoader.load_interactive() inspired by the code here : Background loading — Godot Engine (latest) documentation in English

you can see my code here also : · master · nylnook / turbo-argument · GitLab

Thanks Leon !