New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foreach memory leak (Chrome and Edge) #2223
Comments
Thanks for the report. Would you mind checking if the problem occurs with the TKO alpha? (if you use ko.js you shouldn't have to change any code) |
Good to know, thanks for testing it. That helps likely narrows it down to something in ObservableArray and not the |
No problem. If there is anything else I could test to help you, please ask. If you want to test it yourself, I have added the test project in my first post (at the bottom). |
I don't know if this is important, but when I don't use the foreach binding in my view the memory leak doesn't occur. So when I just update the observable without binding to it, the memory usage doesn't increase. |
I'm seeing the memory increase in the tab, as expected, but I've not been able to diagnose the cause yet. When I run this (with TKO), here's Chrome's Allocation Timeline statistics after running for 10 intervals: And here for 40 intervals: It would appear that memory allocation, at least of arrays, is not the cause of the increase. The "System Objects" appears to be growing. I can only suspect that by saying "System" the inference is that it's not memory references that we control. With some more time I might be inclined to look at the arrayChangeTracking behaviour – disabling the diff caching. Other than that I can only guess that there's a variable that can be set to |
https://jsfiddle.net/q93cgv4w/ With Chrome Timeline tool, I see an ever growing amount of DOM Nodes. Curiously,the heap snapshot tool doesn't show a growing amount of resources, not even detached DOM entries. |
@miellaby I came to the exact same conclusion when I tested this, but I tought I could not find the real cause of this issue, because I'm not that familiar with the memory profiling tools (and the internals of Knockout). But because the issue also occurs in Microsoft Edge I don't think it's a Google Chrome issue. What do you guys think? |
@miellaby That looks like the problem we are having :). So there probably is an issue in the Knockout library, but at the moment it will be very difficult to find out, what causes the issue. What do you suggest, wait until that bug in Chrome is resolved? Or should we test it in Edge? |
From the bug report, it looks like the profiler was working in Chrome/M45. Going back to that version might yield some indication of the leak's origin. |
Hi guys, my 2 cents. Hope it helps. |
This issue is indeed solved in the new version of Chrome. |
I run into an issue when running my KnockoutJS v3.4.2 (test) application in Google Chrome. The memory usage of my page keeps increasing.
The test code is a very simple piece of code, that changes the items in an observable array every second:
HTML:
JavaScript:
Memory usage:
In Firefox the memory usage doesn't increase:
start: 459.6 MB ---> After +- 1 hour: 279.4 MB
In chrome the memory usage keeps increasing (memory of individual tab):
start: 52.912 MB ---> After +- 1 hour: 566.120 MB
In edge the memory usage also keeps increasing (memory of individual tab):
start: 109.560 MB ---> After +- 1 hour: 385.820 MB
Am I doing something wrong in this code snippet? Or is it an issue in knockoutJS (or the browsers)?
Test project:
KnockoutJS.zip
The text was updated successfully, but these errors were encountered: