GLTFValidation Worker Memomy Leak


In my babylon project (togther with react) I am using SceneLoader to import a lot of gltf models.

For each model import, babylon generates a Dedicated worker:

The worker seems to be created by GLTFValidation:


And these workers don’t dispose when I call scene.getEngine().dispose(). I also disposed the loader specifically after model imported:

const loader = SceneLoader.ImportMesh(null, rootUrl, sceneFileName, scene, onSuccess, null, onError, importPlugin);
  if (loader && === 'gltf') {
    (loader as GLTFFileLoader).dispose();

This doesn’t remove the worker either.
I wonder if this is a bug that those workers should be disposed automatically right after model is imported. Right now if I don’t dispose them, they keep adding every time I visit the babylon scene from anther URL and result in a memory leak. Is there a way to dispose them manually together with engine.dispose()?

Thanks in advance!

ping @bghgary

OK, this happens only when inspector is enabled. If it is disabled, there’s no dedicated worker generated. I have an intermediate solution now (is to disable inspector). But for long term it is still valid to resolve this.

The inspector enables glTF validation by default. You can disable glTF validation by doing something like this: