d13 Posted May 23, 2014 Share Posted May 23, 2014 Is anyone else seeing regular 1 second spikes in the chrome garbage collector recently?This isn't happening in Firefox or Safari. Quote Link to comment Share on other sites More sharing options...
ericjbasti Posted May 23, 2014 Share Posted May 23, 2014 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). Quote Link to comment Share on other sites More sharing options...
Antagonist Posted June 3, 2014 Share Posted June 3, 2014 Not every browser vendor implements "garbage collection" the same way. So no need to panic . But if that is the reason for you'r game to freeze from time to time , then google out how to minimize GC in javascript. Quote Link to comment Share on other sites More sharing options...
Gio Posted June 3, 2014 Share Posted June 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
d13 Posted June 3, 2014 Author Share Posted June 3, 2014 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. 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.