I incorporated Babylon js in my web site to show 3d characters, but when running for a few minutes the browser may turn black for a few seconds then restored. The console showed the web context lost then restored. I have checked all memory leaks and fixed but the problem persists. I can only repeat this issue on windows but not Linux. Any idea why and what can I do to prevent this? Thanks.
It is most of the time a memory leak unfortunately or simply an excessive memory usage
It could also be a driver crash. Can you repro on other computers ? if yes can you share a repro ?
I figured out that it may due to I dispose the character’s related resources (meshes, skeletons, animation groups) and recreate it (for some reason I have to do it this way) whenever something changed with the character properties. This could happens many times, and I noticed that the memory wasn’t released. What is the proper way to dispose a character’s related resources completely without disposing the scene? Thanks.
Maybe you forgot to dispose materials and textures ?
Please don’t use for-each cycle since it will not work here for objective reasons.
To dispose meshes from an array use
const mesh = scene.meshes
The same relates to