Files
meteor/packages
David Glasser 583d77e943 Fix Blaze memory leak
This leak occured whenever a DOM element with attributes got removed
from the DOM without destroying its containing view.  For example, an
element in an `{{#if}}` whose condition is toggled back and forth; a
single Blaze.View is used for the `{{#if}}` as its condition changes.

The retention chain was as follows:

The element was saved in the `elem` variable of `materializeTag` in
materializer.js.

Among other places, `elem` was saved in the `attrUpdater` in that
function, which is used by the `updateAttributes` function.

This function is passed to `view.autorun`, which registered this
`onViewDestroyed` handler:

   self.onViewDestroyed(function () { locals.c.stop(); });

That callback retains a references to the computation, and thus to the
DOM element.

Before this commit, that onViewDestroyed callback is not removed from
the Blaze.View when the computation is stopped (eg, because the DOM
element is removed from the DOM, triggering
`updaterComputation.stop()`), so in this case the DOM element is leaked.

(This still has a tiny leak in that you end up with lots of nulls
inside `_callbacks.destroyed`; using a better data structure for
callbacks is a game for another day.)

Fixes #4289.
2015-04-29 00:35:29 -07:00
..
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-29 00:35:29 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-14 14:47:16 -07:00
2015-03-17 13:06:07 -07:00
2015-04-14 21:34:46 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-25 13:56:03 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-21 14:01:59 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-31 12:03:53 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:41:14 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-03 12:01:49 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-14 21:48:41 -07:00
2015-03-17 13:06:07 -07:00
2015-03-31 16:36:15 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-03-17 13:06:07 -07:00
2015-04-14 14:31:44 -07:00
2015-03-17 13:06:07 -07:00