Webgl crashes after Unity scene load memory cleanup

Unity: 2018.0.1f2
Browser: Happens in Chrome and Firefox, probably edge and safari but not tested yet.

When a new Unity scene loads in WebGL, Unity does some memory clean up. Most of my scenes load perfectly, pulled into the project using assetbundles.

The scene, avatars, seems to trigger a crash most of the time but I’ve seen the crash on other scenes as well.

Error code usually 160 but I’ve also had 163. I’ve tried verbose exceptions and nothing comes up. Makes me feel the error is internal to Unity after doing the memory clean up.

I do notice the scene shows a success load log

then several frames later shows the log for cleaning up the memory

After this log is alway were the crash happens.

I’ve tried:

loading scenes built into the project.

rebuilding the scene from a new scene.

adding more assets to the scene because most of these scenes are pretty light with controllers that load in additional assets after the scene loads.

re-written a bunch of code and inserted tons of logs to track this down. It always happens right after the memory clean up method no matter what is going on in between the scene load log and the Total: --ms log. I’ve also added a yield and waited for seconds after the scene loads to allow the memory to clear before continuing…

still can’t crack it.

Any thoughts?

Hi, sorry for add reply in this old post.
I just found similar problem and google lead me here.
I can’t find the solution any where. but at least, I managed to solved it. so I want to make a reply here.

in my case, DOTWEEN ( plug in for making tween animation : DOTween (HOTween v2) | Animation Tools | Unity Asset Store ) is the problem.

normally it should kill itself after animation finish.
but I noticed that, the crash will happen if I run dotween before changing the scene. eventhough the animation already finished before loading new scene, it crash in WebGL. (run normally in Editor)

I have to force kill all Dotween instance in scene with command DOTween.KillAll(); before changing scene. and the problem gone.

just want to chare some idea. may be some of your component cause the same problem.