WebGL memory problem

Hello, I’m running into an “out of memory” error when lauching the index.html file. Here’s what the Firefox Web Console got :

Invoking error handler due to
Uncaught abort(“Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 268435456, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.”) at Error
at jsStackTrace (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:1:22814)
at stackTrace (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:1:22997)
at abort (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:33:50745)
at enlargeMemory (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:1:23347)
at Function.dynamicAlloc [as alloc] (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:1:8283)
at _sbrk (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:1:325501)
at ecm (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:26:127113)
at heb (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:19:1098792)
at Leb (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:15:9369)
at Array.veb (blob:http%3A//zbim.fr/5dd8e422-57bd-48f3-b2da-8c4bfbdee1d1:19:1103615)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

I have already watched several topics, yet none of them really helped me to fix this problem
What is the best way to optimize memory on build ? (is there even a best way ?)
I’ve already planned to use “Fastest” optimization mode, don’t build in Development, turn on stripping and turn off exceptions, as acknowledged in Unity’s documentation.
I’ve tried many builds, some of them DO work at first, yet after a few minutes the WebGL stop working due to a lack of memory…

Have you checked with the memory profiler how much memory you need ? Perhaps you need more than the current WebGL Memory Size.

According to the memory profiler, I need at least 270 MB at runtime, so it should be okay with WebGL Memory size.

Bump. Did you find any solutions Angal? We are having similar issues and have thrown lots of settings at the wall and nothing is sticking.

I’m sorry I have not yet sadly.

But, that is more then your currently selected WebGL memory size (at least according to the error you posted, which looks like your WebGL memory size it at the default 256 MB)?

When I took the pic, the memory size was indeed set at the default 256MB, yet since then I had it changed.

I have similar issues, my project worked fine in 3D since 80% was sprites I rebuilt in 2D
now everything works in PC build, even webplayer (except of some rendering) I packed sprites and ran into other issues, 256 is to little, 512 is too much.
I should need about 220.
Tried on different machines too, very high end to simpler and even linux laptop, same issues in all. Browser: Firefox