Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This sounds like a classic Zombie View problem. Basically when you do this:</p> <pre><code>this.model.bind("reset", this.render, this); </code></pre> <p>in your view, you never unbind it. Thus, the view object is still bound to the model and can't be removed from memory. When you create a new view and reset, you have that listener still active which is why you see the duplicate view production. Each time you close and redo the view, you're accumulating listeners which is why it increases in multiples of 4.</p> <p>What you want to do is <code>unbind</code> your listeners when you close out the view and rid your program of binds.</p> <pre><code>this.model.unbind("reset", this.render, this); </code></pre> <p>This should eliminate the pesky zombies. I'll add a link with more detailed information when I find it.</p> <p><strong>UPDATE - added useful references</strong></p> <p>I also ran into this problem a while back. It's quite the common gotcha with Backbone. @Derick Bailey has a really good solution that works great and explains it well. I've included the links below. Check out some of the answers he's provided in his history regarding this as well. They're all good reads.</p> <p><a href="http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/" rel="nofollow">Zombies! Run!</a></p> <p><a href="http://lostechies.com/derickbailey/2012/03/19/backbone-js-and-javascript-garbage-collection/" rel="nofollow">Backbone, JS, and Garbage Collection</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload