OK, I'll post an update to this issue.

To the best of my ability, it seems what's happening is that the main scope 
for the element (not the semi-isolate scope for the grid directive) gets 
$destroy()d.  However, the child scope which is using that scope as the 
prototype is most likely bailing out of the $destroy method early, because 
self.$$destroyed is true (prototypal inheritance). So listeners and 
watchers do not get cleared.

I probably could update the directive to be fully isolate in scope, but I 
don't have time to sort out the implications of that.

I also found it's more than just $destroy.  The $scope itself has a LOT of 
functions defined on it by the directive that form closure around internal 
vars that hold a lot of memory. 

So, I wrote a service that supplies additional cleanup that is easily 
injected into the questionable grid directive. I have a plunk demo'ing it 
here <http://plnkr.co/edit/r2uTKTJW2yJTbHx0kXYB>.  Now, you can switch 
grids all you like and none but the current grids will remain on the heap.

Hope this helps someone going forward,

J

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to