Dear BabylonJS community,
I am running into WebGL memory issues when disposing BabylonJS engines. BabylonJS is only used within one module of my SPA. That module is not necessarily being used when using the app. This is why the BabylonJS engine and therefore all their scenes/meshes/… are disposed when exiting that part of the app. Unfortunately they seem to remain in memory:
Each new BabylonJS engine creates a new WebGL context within the browser. Because the engines are not correctly disposed, the amount of WebGL contexts keeps growing until app crash or browser warning.
Unfortunately, I could not reproduce this in a BabylonJS playground. The engines are correctly disposed when hitting the “Run” button.
Here is what I have tried:
- Disabling features that might reference the engine indirectly and prevent disposal by the garbage collector
- Explicitly clearing WebGL contexts with the WebGL API loseContext
- Explicitly reusing the WebGL context on engine creation
Are there any other potential causes to this?
Thanks and best regards