Jump to content

How do you prevent memory leak in Babylon.js?


Recommended Posts

I'm coding using babylonjs + reactjs. And I suspect there's memory leak somewhere in the code as stuff gets laggy over time.

So what's the 101 list that I should check? 

I've imported a few assets, then created instance of them, also I'm creating new mesh as bullet everytime user click shoot button. 
In componentWillUnmount, I dispose every asset, and that's all I did. Is there something missing?

Link to comment
Share on other sites

So you're using React :D

The thing to do is to use the F12 memory profiler. Run your app, go to the profiler and capture a snapshot. Then do stuff and go to a state where you think you removed everything then do a second snapshot.

You can then compare them and see which objects were created and not removed

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