We have an app where we construct multiple scenes and destroy them. While investigating a memory leak, I found an issue that seems that all materials loaded via the babylon file loader are stored in a global object: Babylon.js/babylonFileLoader.ts at master · BabylonJS/Babylon.js · GitHub. These references retain the scene itself and causes big memory issues for our app.
Would it make sense to refactor this to use a WeakMap on the passed in Scene?