Open dlederle opened 10 years ago
I left BotPrint running while I read the papers for class tomorrow. Happened again. I'm not sure if it happens when you interact with the app for 20-30 mins, or just if you leave it.
I'd guess that things are invisibly getting added to the box2D arena, but not removed, which could be from wheels, or the bots, somehow. I'll take a look to see if javascript has a way to detect which object is getting huge.
On Thu, May 22, 2014 at 2:05 PM, Dylan Lederle-Ensign < notifications@github.com> wrote:
I left BotPrint running while I read the papers for class tomorrow. Happened again. I'm not sure if it happens when you interact with the app for 20-30 mins, or just if you leave it.
— Reply to this email directly or view it on GitHubhttps://github.com/galaxykate/BotPrintEvolved/issues/47#issuecomment-43943999 .
Found another way to reproduce: try to run 1000 generations of a test...
While trying to fix my own Box2D problems, I ran into this:
http://www.tamats.com/blog/?p=508
The relevant information is under Memory Management. Paraphrasing here, essentially what this port of Box2D does, in order to go faster, is fake the C++ memory model in Javascript arrays. The problem is that this sorta invalidates the Javascrpt garbage collector-- Javascript's GC has no idea when we're done with some memory, because we'll always have a reference to it, and also has no idea about deleting it out of these arrays.
So, we got to be careful to explicitly delete box2D things when we're done with them ala the Box2D.destroy() method. I can come up with a few places where we can cut out some extra b2Vec2 objects lying around, which might fix the problem. Getting rid of extra b2Body objects'll be a bit harder.
I'll get on it tomorrow, unless someone else has some time this weekend.
Not that it matters right now, but another thing to consider is to switch box2D ports. Box2DWeb (https://code.google.com/p/box2dweb/) is another Box2DFlash port to Javascript, albit an older version. Don't listen to the lies on the page-- box2D.js used to be depreciated, then box2DWeb came out, and now we're using a new version of box2D.js generated with Emscripten. Box2DWeb uses someone's hand written translator, which is a little terrifying on the speed side of things, but it does come with a really easy debug drawing set of commands.
I'm not biased or anything.
On Fri, Jun 6, 2014 at 2:31 AM, Dylan Lederle-Ensign < notifications@github.com> wrote:
Found another way to reproduce: try to run 1000 generations of a test...
— Reply to this email directly or view it on GitHub https://github.com/galaxykate/BotPrintEvolved/issues/47#issuecomment-45318929 .
Not sure how to fix this, or even if its a real problem. I had botprint running in another tab while i surfed the interwebs. Came back to it after lunch (20-30mins?) and had the error output listed below. Seems like Box2D ran out of memory? Something to keep in mind going forward.
Terrible error output pasted below:
Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value, or (2) set Module.TOTAL_MEMORY before the program runs.: Error at Error (native) at Ea (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:9:37) at Function.Aa (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:8:171) at oc (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:176:172) at vh (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:207:18152) at vo (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:207:32432) at qO (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:206:159099) at new vu (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/box2d.js:499:429) at Class.extend.toB2Vec (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/modules/botPrint/physics/boxWorld.js:151:24) at Class.extend.setBodyToTransform (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/modules/botPrint/physics/boxWorld.js:181:36) at R. (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/modules/botPrint/physics/boxWorld.js:324:26)
at Function.jQuery.extend.each (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/vendor/jquery-1.10.1.js:657:23)
at Class.extend.simulate (file:///home/dlederle/workspace/BotPrintEvolved/Bots2/js/modules/botPrint/physics/boxWorld.js:323:15) box2d.js:3
Uncaught Assertion: Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value, or (2) set Module.TOTAL_MEMORY before the program runs. processing-1.4.1.js:4076