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

AngularJS: Memory Leak with ng-repeat using custom objects (w/simple PLUNKR) #11169

Closed
momoadeli opened this issue Feb 24, 2015 · 2 comments
Closed

Comments

@momoadeli
Copy link

(SIMPLE PLUNKR HERE: http://plnkr.co/edit/1Adh2P65ZS8YHYJZhLMk)
(DETAILED STACKOVERFLOW EXPLANATION HERE: http://stackoverflow.com/questions/28683992/angularjs-memory-leak-with-ng-repeat-using-custom-objects-w-simple-plunkr)

SUMMARY:

There is a leak using ng-repeat after the 2nd wave iterating over an array of custom objects like this :

<div ng-repeat="d_sampleObject in mySampleObjects">
    {{d_sampleObject.description}}
</div>

NOTE: 'mySampleObjects' is an array of the following object instances:

    ml.MySampleObject = function (id) {

        this.id = id;
        this.description = 'this is object #:' + ' '+id;
    }

Memory profile reveals an extra 'd_sampleObject' left over and not de-referenced. More details (via a controller and an injected service) in the Stackoverflow link above. A simple demonstration also in the provided plunkr link. Any thoughts and help greatly appreciated in advance!

@momoadeli
Copy link
Author

Reading the latest comments, is it safe to assume that this is indeed a bug in the framework? if so, what timeline should we expect to have a fix? Thanks for your efforts! @Narretz

realityking added a commit to realityking/angular.js that referenced this issue Feb 25, 2015
@realityking
Copy link
Contributor

I'd see this more of a limitation of the V8 garbage collector than a bug in Angular. It is however a nice little optimisation opportunity. If there are no issues the change will probably be part of 1.3.15.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants