From 553c252d5ce1a56756df29ded7cce0b48b536fc5 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 1 Apr 2014 16:43:25 -0700 Subject: [PATCH] revert: fix(Scope): aggressively clean up scope on $destroy to minimize leaks This reverts commit f552f25171390e726ad7246ed18b994970bcf764. The commit is causing regressions. Closes #6897 --- src/ng/rootScope.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index aec16298..e09e2202 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -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; }, /**