Scene.dispose() hangs on my system, but cannot reproduce the error in the Playground

Hello, I have this frustrating issue. For starters, I’m just creating a personal pet project that is trying to restart the stage of a game. In my project, it seems that when I use scene.dispose() to start the stage, the game hangs. The CPU meter on my desktop would go nearly 90% and would stall the browser. The only way I would get out of this is to close the browser and restart the game again.

The Playground test provided shows no errors but yet in my project, it hangs. I am using the 5.50.1 build of Babylonjs at the time of this writing so, this is clearly something that I am doing wrong.

Anyone could give me pointers in figuring out what could result in a scene.dispose() be very resource intensive? I tried the obvious the resources are large to begin with, but I doubt this is the case with my project. Also, I found this previous post: Scene.dispose() hangs,

scene.dispose is doing a lot of things (Babylon.js/scene.ts at master · BabylonJS/Babylon.js · GitHub), basically it disposes of everything (meshes, lights, animations, materials, etc).

What you could do is take a snapshot of what’s running when the system crashes and see what you can find in the report: in Chrome, it’s in the developer’s “Performance” tab.

2 Likes

@Evgeni_Popov I tried that, but it even crashed the Performance Inspector of Chrome. On the bright side, I just recoded my game to not to dispose the scene but to diligently manage the resources such as the mesh, music and GUI objects.

Thanks for your help.

2 Likes