Pryme8 Posted August 29, 2018 Share Posted August 29, 2018 So to what extent does disposing the mesh, clean up the entities that may be initialized under it like a non shared material or the texture used by that material? I know if there is a physicsImposter, you need to dipose of it before the mesh... but how much other stuff needs to be cleaned up? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 29, 2018 Share Posted August 29, 2018 Calling mesh.dispose() will automatically dispose the children but not attached materials (unless you set the 2nd parameter to true): https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.ts#L1811 The dispose will remove: - Geometry - observables - instances - actionmanagers - physicsImpostor (no need to dispose it beforehand: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.abstractMesh.ts#L1542) - submeshes - selection octrees Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 29, 2018 Author Share Posted August 29, 2018 Ive come into the situation where the physicsImposter does not, is that because I sometimes name it body? I figured the dispose recursively goes through the variables assigned to the mesh and checks for a dispose method. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 29, 2018 Share Posted August 29, 2018 If you need to first dispose the impostor then we have a bug Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 29, 2018 Author Share Posted August 29, 2018 hmm the scene where it happens is pretty complex... not sure if I could recreate it in a PG. Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 30, 2018 Share Posted August 30, 2018 For any mesh, if I don't dispose of everything including materials and bounding meshes/impostors, then they haven't disposed from my browser memory. I wish I didn't have to add so many extra lines of code, but otherwise, I see memory remnants. DB Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 30, 2018 Author Share Posted August 30, 2018 Hmf, I think we might have a bug then... ffuuuuuuu that means I gotta try to recreate this... Ok then give me a while here and Ill put together a structure that at least displays this behavior with the physicsBodies Quote Link to comment Share on other sites More sharing options...
Guest Posted August 30, 2018 Share Posted August 30, 2018 @dbawel we should not, please send a repro in the PG so I can fix it Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 30, 2018 Share Posted August 30, 2018 @Deltakosh It's old habit from a few versions back. Are you saying that disposing of a single mesh also disposes of all attributes of the mesh including materials, textures, shaders, etc? We're not talking scene dispose. But if mesh dispose works this way, then what about shared attributes? Thanks, DB Quote Link to comment Share on other sites More sharing options...
Guest Posted August 31, 2018 Share Posted August 31, 2018 You can force the mesh to dispose its children as well as its material and textures: http://doc.babylonjs.com/api/classes/babylon.mesh#dispose Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.