Jump to content

Chrome garbage collection spikes


d13
 Share

Recommended Posts

The garbage collector going off once a second isn't really anything new (but ideally is less so). Whats probably changed is the amount of garbage it has to collect (and time spent collecting). Use the dev tools and record a memory timeline. Find the GC events and see how much memory they collect (free up) each time they run. Ideally you're avoiding megs of data when its running this often. Do know however that as Chrome optimizes how it runs your code the GC will go off more often, but with much smaller amounts of data. My current game collects every 4-5 seconds and its collecting about ~1meg of memory (note that even having the dev tools open adds to this). With the dev tools closed it runs a constant 60fps (2007 iMac).

Link to comment
Share on other sites

  • 2 weeks later...

It's very implementation-specific (meaning that it will change a lot across browsers), so be careful when optimizing it. You may be optimizing for Chrome while un-optimizing for another browser, if that makes sense.

 

Recycling objects rather than constantly creating new ones is good practice anyway, and would be a good idea regardless of the browser - except for IE which, while being crap in many ways, has the best garbage collector ever: zero spikes, as it all happens in parallel on a different thread. I wish Chrome and Firefox did something like that.

Link to comment
Share on other sites

Thank you all for your replies! :)

This only happens in Chrome - Safari and Firefox run happily at close to 60fps without spikes.

I've also been wary of premature optimization because I don't trust Chrome anymore.

There's been a lot of wild experimentation going on in Blink, and I think it's going to be a while before it stabilizes.

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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