Thursday 15 April 2010

javascript - When does a BackboneJS ModelView get garbage collected in this case? -


I have a list setting and instance view in the backbone code. The list view is linked to a collection and it instantly updates an InstanceView

  render: function () {this.collection.forEach (function (example) {var comment HTML = new instance view ({model: example}). Rendered (); sung Comments: Push (Comment HTML);}); }   

After the render call ends, the new view exits from the scope. What I have noticed is that this view remains in memory, though. I can tell because even after the render method, the incidents related to it still start to fire.

So, it seems that GC avoids GC due to reference to model object, which, in turn, is referred to by collection?

Model is registered on the model when the scene is created. The callback has references to the view, preventing it from being gc'ed.

Look at the backbone code. Incidents are accustomed to the representative event method.

No comments:

Post a Comment