@@ -779,15 +779,16 @@ function $RootScopeProvider() {
779
779
lastDirtyWatch = watch ;
780
780
watch . last = watch . eq ? copy ( value , null ) : value ;
781
781
watch . fn ( value , ( ( last === initWatchVal ) ? value : last ) , current ) ;
782
- if ( ttl < 5 ) {
782
+ // V8LeakFix
783
+ /*if (ttl < 5) {
783
784
logIdx = 4 - ttl;
784
785
if (!watchLog[logIdx]) watchLog[logIdx] = [];
785
786
watchLog[logIdx].push({
786
787
msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
787
788
newVal: value,
788
789
oldVal: last
789
790
});
790
- }
791
+ }*/
791
792
} else if ( watch === lastDirtyWatch ) {
792
793
// If the most recently dirty watcher is now clean, short circuit since the remaining watchers
793
794
// have already been tested.
@@ -873,6 +874,11 @@ function $RootScopeProvider() {
873
874
$destroy : function ( ) {
874
875
// We can't destroy a scope that has been already destroyed.
875
876
if ( this . $$destroyed ) return ;
877
+
878
+ // V8LeakFix (recursively destroy child scopes)
879
+ while ( this . $$childHead )
880
+ this . $$childHead . $destroy ( ) ;
881
+
876
882
var parent = this . $parent ;
877
883
878
884
this . $broadcast ( '$destroy' ) ;
@@ -908,6 +914,7 @@ function $RootScopeProvider() {
908
914
// - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
909
915
// - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
910
916
917
+ this [ 'this' ] = this . $$ChildScope = // V8LeakFix
911
918
this . $parent = this . $$nextSibling = this . $$prevSibling = this . $$childHead =
912
919
this . $$childTail = this . $root = this . $$watchers = null ;
913
920
} ,
0 commit comments