Search Issue Tracker

Fixed in 2021.1.X

Fixed in 2019.4.X, 2020.2.X



Found in


Issue ID




[WebGL] Build crashes if metadata is too large



WebGL build fails to start with the following error messages:

exception thrown: abort({}) at jsStackTrace@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:942:12
___mmap@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e line 1379 > WebAssembly.instantiate:wasm-function[177106]:0x31a401b
__ZN6il2cpp2os16MemoryMappedFile4ViewEPNS0_10FileHandleEPxxNS0_22MemoryMappedFileAccessES4_PNS0_21MemoryMappedFileErrorE [il2cpp::os::MemoryMappedFile::View(il2cpp::os::FileHandle*, long long*, long long, il2cpp::os::MemoryMappedFileAccess, long long*, il2cpp::os::MemoryMappedFileError*)]@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e line 1379 > WebAssembly.instantiate:wasm-function[174667]:0x314c36a

TypeError: "attempting to access detached ArrayBuffer"
mmap blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:4914
mmap blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:6692

The problem is in the system libraries of the Emscripten compiler that is used to target WebAssembly. A fix to the compiler has been posted and landed at .

The fix will eventually find its way to an upcoming Unity release when we update the Emscripten compiler to a new version, but there is, unfortunately, no release ETA for that, since compiler change affects all components of Unity, and needs a complete testing process.

If you want, you can locally patch your Emscripten compiler to carry the fix, by changing the two lines as shown by diff in file library_memfs.js inside Unity installation tree.

Another workaround can be to use a Unity editor script to assign "PlayerSettings.WebGL.memorySize = 256;" or similar so that the deployed build has a large enough heap at startup to avoid the issue.

Comments (2)

  1. robertirribarren

    Apr 17, 2020 01:08

    Had this issue on 2019.3 release version as well.

  2. Twyker_gp

    Feb 04, 2020 16:55

    Had this issue on 2019.3 release version. Only replacing the code as mention above did the trick.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.