Jump to content

How to properly dispose PolygonMeshBuilder


Recommended Posts

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:

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.

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...