Jump to content

Garbage collection


SteveBaker
 Share

Recommended Posts

I'm writing an online game (using the super-sexxy WebGL stuff to do full 3D rendering in the browser). I find that my otherwise fast/smooth 33ms framerate is interrupted with gigantic (200ms to 500ms or more) glitches every few seconds. The behavior is the same in Firefox 4 and Chrome 10 - I can't test it under IE because Microsoft are carefully ignoring WebGL (perhaps hoping that it'll "go away"!)My computer isn't running any other programs while doing this - this is the only tab that's open - there is no change to the on-screen content so the load should be totally constant - and in this particular game, I'm not talking to the network or anything.The only cause for this that I could reasonably guess (although you may know better) would be Garbage collection from JavaScript. So here are my actual questions:* Are there any tools for discovering when the garbage collector is running?* Are there any other ways to confirm this hypothesis?* What are the criteria that tell JavaScript to garbage-collect?* Are there any strategies to either drastically reduce the amount of time that the garbage collector consumes - or perhaps increase the intervals between these massive glitches?I'm trying to minimize or even eliminate the amount of memory I dynamically allocate - but I suspect that there are things that JavaScript is doing behind my back that may be doing dynamic allocations - and I have some 3rd party library code that I don't particularly want to rewrite. -- Steve

Link to comment
Share on other sites

One thing you can do is use the profiler in Firebug to figure out which functions are taking the most time. There's a button on the console tab to start or stop the profiler. Once you know which functions are taking the most time or running the most often then you can look into why that is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...