Does webgl share memory limit with webpage?

I’m having some trouble trying to implement a application who interacts with the webpage using webgl, it did well on prior unity web plugin… but since chrome stopped supporting those plugins, I had to switch to webgl.

Since I’ve finished the plugin code, optimizations, etc and tested with a local, simple webpage, i’ve switched to test on real world webpages… on those, The player is throwing: Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 67108864 (64Mb), (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.

Is this possible the WebGL Memory Size is being affected by the page memory use?

Other thing I’ve noticed is that the webpage memory usage is about: 35Mb… when I start the plugin… it jumps to 700Mb… I though it was limited to 64Mb… is that behaviour right?

There are different uses of memory by the browser. The 64 MB is the size of the Unity heap (used for currently loaded objects) which you can configure in the WebGL player settings. The error message tells you that it is not large enough, so you need to pick a larger value.

FYI: Because these are common questions, I added a page to the Unity 5.2 manual with more in-depth explanations on how memory is used in WebGL. You can preview it here: Unity - Manual: Memory Considerations when targeting WebGL

Edit: I just read that it works for you locally, but not in a real-world web page. That sounds odd. Possibly, you have an older version of your html file still in the cache, which has a lower memory value configured? Try purging your browser cache.

Thank you, your link was really helpfull!

It was happening because we are using SimpleJSON from UnityCommunityWiki to read a json, and it parses the string exactly the way you described in the url.

Now I’m doing the Json via Javascript Plugin, and we have no problems with this anymore.

Thanks victorafael_com . You are right. After replacing simplejson with jsonfx, memory problem of my app solved, too.