Vousk-prod. Posted September 21, 2017 Share Posted September 21, 2017 Hi, Is there a clean way to dispose a PolygonMeshBuilder used in a function or it is not usefull to do so because gc will do it for us when function is terminated? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 21, 2017 Share Posted September 21, 2017 You can clear the reference to an instance of a PolygonMeshBuilder by assigning something small like undefined or null. Then it will get GCd by javascript. You can look at the source - there is no dispose() like on Mesh objects:https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.polygonMesh.ts If the PolygonMeshBuilder leaves scope it is also collected. If you just have one then I wouldn't worry about it, but if they are created dynamically and stay in memory then you probably should as the holes and points stay in memory. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 21, 2017 Author Share Posted September 21, 2017 I know there is no dispose for this class, that's why I posted my question. Once finished, my function leaves its scope, but this function is called often and create a new PolygonMeshBuilder each time. I supposed gc cleans them but was not sure. I will assign undefined at the end for safety. Anyway how can I check if an object stay in memory ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 21, 2017 Share Posted September 21, 2017 You can still use the memory profiler of your browser But if you plan to often use the PolygonMeshBuilder, you may want to keep it alive and reuse it Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 21, 2017 Author Share Posted September 21, 2017 Unfortunatly I don't know how to use the memory profiler to track such a specific element (I'm using FF Developper, and for those particular debugging aspect the doc is crapy, is there a good tool and doc for this profiling stuff in Edge ?). I'd like to keep my builder alive, but there is no setter to update the path (contours var of the constructor). I could manually empty points and _outlinePoints and _points and "toe points" and set all of them again, but it would be a hack I'm not sure if clean enough to work in any case, and it's then almost the same as creating a brand new builder... Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 21, 2017 Author Share Posted September 21, 2017 Also about the resulting built mesh's name ? I can't specifiy different name for different meshes built with one single builder... (except by changing private var _name of the builder) Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 21, 2017 Author Share Posted September 21, 2017 Hmm, I also need to remove previous holes already added... Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 21, 2017 Author Share Posted September 21, 2017 since I need to change everything in it I think it is easier and better choice to create a new builder each time Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 22, 2017 Share Posted September 22, 2017 lol yeah 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.