Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
revert: fix(Scope): aggressively clean up scope on $destroy to minimi…
Browse files Browse the repository at this point in the history
…ze leaks

This reverts commit f552f25.

The commit is causing regressions.

Closes #6897
  • Loading branch information
IgorMinar committed Apr 1, 2014
1 parent 789328d commit 6621adb
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,26 +731,15 @@ function $RootScopeProvider(){

forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));

// sever all the references to parent scopes (after this cleanup, the current scope should
// not be retained by any of our references and should be eligible for garbage collection)
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;

// This is bogus code that works around V8's memory leak coming from ICs
// see: https://code.google.com/p/v8/issues/detail?id=2073#c26
//
// for more info also see:
// - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
// - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
for (var prop in this) {
if (hasOwnProperty.call(this, prop)) {
this[prop] = null;
}
}
// recreate the $$destroyed flag
this.$$destroyed = true;
// This is bogus code that works around Chrome's GC leak
// see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
this.$$childTail = null;
},

/**
Expand Down

0 comments on commit 6621adb

Please sign in to comment.