Skip to content

Commit bd524fc

Browse files
committed
fix($rootScope): workaround for Chrome's memleak
Under certain circumstances chrome fails to GC scopes because of buggy optimizations and caching. Nulling out references to (not from!) other scopes helps Chrome to realize that this object should be GC-ed. This is really just a workaround as the real problem needs to be fixed in Chrome. See discusstion at: angular#1313 (comment) And chrome bug at: https://code.google.com/p/v8/issues/detail?id=2073 Closes angular#1313
1 parent 19a324c commit bd524fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ng/rootScope.js

+5
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ function $RootScopeProvider(){
476476
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
477477
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
478478
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
479+
480+
// This is bogus code that works around Chrome's GC leak
481+
// see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
482+
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
483+
this.$$childTail = null;
479484
},
480485

481486
/**

0 commit comments

Comments
 (0)