kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.33k stars 196 forks source link

Intermittent freezing after running for ~10 minutes #79

Open chadams77 opened 8 years ago

chadams77 commented 8 years ago

The page freezes for a small amount of time every 3s or so after running for roughly 10 minutes. I've looked over my code, and I seem to be deallocating all the vectors I create, although I do create and destroy a lot of b2Vec2 objects every frame. Tried in incognito as well, doesn't appear to be a plugin. Just using box2d-js and jquery. Perhaps there's an issue involving keys to internal memory allocations not being destroyed along with the objects? I'm running in the latest version of Chrome on Windows 10.

chadams77 commented 8 years ago

box2d-bug

I ran a short profile during one of the freezes, Array.destroy is a function I added to the array prototype which is shorthand for "call Box2D.destroy on all elements in this array"

Note that the number of objects being created & destroyed per frame doesn't change during the ~10 minutes before the freezing.