Memory settings for WebGL content: Array Buffer Allocation Failed vs. Out of Memory Exception

I am struggling with choosing the right memory size for my WebGL game Silly World Series. I’ve read all unity answers threads I could find on the topic of WebGL Build memory size, but I have some questions.

For the record, my WebGL Memory Size is currently set to 400Mb.

Error Messages

My game is live in the AirConsole store and has been played about 300 times since I uploaded it yesterday.
We have a tool (developers console) that saves javaScript errors that users experience, to help us track issues. The tool reports the following errors:

Uncaught RangeError: Array buffer allocation failed

Occurred in 23 cases / ~5%

Screenshot of Error Message

To make sure I get this right: This error occurs when the content is loading, and the browser tries to allocate 400mb of memory, but the browser says “Nope, can’t give you that much.” Is that correct?

Uncaught Exception: Out of Memory

Occurred in 7 cases / ~1%

Screenshot of Error Message

Again, to make sure I understand correctly: this is what shows up when the game is running, but the 400mb aren’t enough to run it anymore. Correct?

Uncaught RangeError: Invalid Array Buffer Length

Occurred in 8 cases / ~1%

Screenshot of Error Message

I have no idea what this one is about. Any ideas?

###Weird issues / Inconsistencies###

  • Someone tried to play the game using Firefox on Windows 8.1 and a powerful gaming PC. They got a message saying “The browser could not allocate enough memory for the WebGL Content”, which I assume is what shows up as “Array Buffer allocation failed” in my dev tool. (Using Chrome on the same PC worked)
    Which factors determine how much memory Firefox can allocate? Because we’ve tested it using Firefox on a Macbook Pro and had no memory issues. Is there a setting for how much memory the browser can allocate?
  • When testing on our Macbook Pros, we’ve never run into any “out of memory” issues (regardless of browser), even with a smaller memory size than 400mb. On my coworker’s Macbook Air however, the game runs out of memory halfway through. I realize that the game might not always use the exact same amount of memory, but since it happens consistently on one computer and never on the other, I wonder: Why would the 400mb be enough on one computer but not the other?



  • Since it’s very frustrating for players to start playing the game and then running out of memory, I am more inclined to increase the memory size: I’d rather people know if they can run the game at the beginning, instead of getting interrupted halfway through.
    However: The more content I add, the bigger the memory will have to be, the fewer people will be able to play my game - is that something I just have to accept or can I do anything about it?

  • What can I do to reduce memory usage?
    I’m pooling objects and caching variables as best I can. What other things have an impact on how much memory my game will need?
    (For the record: code stripping is enabled, I’m making ‘fastest’ builds, import settings of textures etc. are set to ‘compressed’ and appropriate sizes…)

Have a look at these blog posts: