Cleaning up scene on Hot Module Replacement

I am currently using hot module replacement with React, and I have a memory leak related to Scenes and Vectors that are retained when a module is replaced. What is the best way to dispose of a Scene, Engine, Camera, Meshes, etc. with HMR?

1 Like

Hi @blitt6

you can dispose whole engine with engine.dispose(), or just scene scene.dispose(), depends on you r needs.

That can be done on unmount for example in react