- Home /
WEBGL memory usage
Hey, I've started a WEBGL project in unity, but have a couple of problems concerning memory usage.
When I open the project in my browser it takes up about 700MB of memory. This is a problem, but I understood that the problem there was that browsers are bad at loading huge javascripts in one go. This will hopefully be fixed in Chrome, FF and IE/Edge before our release(sometime next year). The second problem is the garbage collector. When the project is done loading and stops at around 700MB it slowly goes down to 350MB which is a lot better. Is there any way to make this go faster, instead of waiting 5 minutes?
I also created a project with an empty scene, and nothing else. When I compiled the WEBGL version it by default used about 400MB of ram, though it slowly builds down to about 80MB of memory after a while. Do you have any plans to decrease the size of the basic unity WEBGL build so it won't be this big when there is nothing in it?
If I reload a page with a unity webgl project in it, the memory use doubles. Because it looks like it doesn't clear out the last instance before the new one is loaded. So when I reload my project it peaks out at about 2GB memory, which is insane. Any way to fix this?
Hi, I'm not familiar with webgl, just an idea: have you tried calling GC.Collect after the scene is loaded to see if it reduces memory usage quicker ?
Didn't help. I see no difference after GC.Collect() is called.
No, not really. To get away from some of the memory issues we use chrome canary and just hope that chrome will get better before our official release. We also always load an empty scene first, that just redirects to the actual scene after a few seconds. Other than that, it's a lot of tweaking the totalmemory given to emscripten and a lot of loading resources from the server after unitys initial load.
I hope that helps a bit.
-Garlov
Your answer
![](https://koobas.hobune.stream/wayback/20220611233420im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
RAM problem on mobile phone? 0 Answers
android memory, VRAM max usage? 0 Answers
Asset bundle shader standard 0 Answers
How does Unity/Android use/manage SWAP and RAM files ? 0 Answers
lightmap vs normals 2 Answers