From c79c2b1030c7a08ab339d8870d3db424f4ab4318 Mon Sep 17 00:00:00 2001 From: Heno Pied Date: Fri, 12 Feb 2016 10:15:14 -0600 Subject: [PATCH] Fixed memory leak bug Deletes useless balls --- client/js/ball-view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/js/ball-view.js b/client/js/ball-view.js index 9ea5488..661b659 100644 --- a/client/js/ball-view.js +++ b/client/js/ball-view.js @@ -23,7 +23,10 @@ class BallView { if (eater && eater.ball.id != this.ball.id) { this.x.follow(() => eater.x.get(), 100); this.y.follow(() => eater.y.get(), 100); - setTimeout(() => this.disappear(), 50); + setTimeout(() => { + this.disappear(); + delete this.main.balls[this.ball.id]; + }, 50); } else { this.disappear(); }