-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Memory Leak when changing innerHTML having dom-bind #4954
Comments
This leak is probably partially explained by your May not explain this problem entirely, but it explains much of it. |
Updated code as per you suggestion. Still same amount of memory leak. |
@TimvdLippe can you elaborate on the status here? |
Paging @kevinpschaaf and @sorvell who actively maintain Polymer atm |
When I run the Polymer 2 version, I do not see memory or dom nodes growing unbounded. With the memory devtools tab open, I see these grow until a gc, at which point they return to within a bounded region. Pressing the "Collect garbage" button (forcing a manual gc) appears to return the heap/dom nodes numbers to the same baseline point. Can you re-confirm? Also note there was a long-standing memory leak on Polymer 2.x/3.x that was fixed/released in March of this year (#5250) related to the dom-if/dom-repeat debouncer flush queue, but I believe was unrelated to this code since 2.x's dom-bind does not use a debouncer. |
Actually we were facing a memory leak in one of our legacy apps but after diving it might be related to another problem, I also didn’t see the issue in the plunkr above... Just assumed two things were related. I guess you should close this issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
When we change inner HTML having dom-bind, earlier nodes added are not removed completely hence causing memory leak.
Use Case: In our app we add components dynamically which has data binded with other existing components. To make binding work we change innerHTML in a div (as given in below example)
Live Demo
https://plnkr.co/edit/q0mvZVoXjiSxuVyzIBVn?p=preview (Polymer v 1.11.0)
https://plnkr.co/edit/NrLB0iXLhbzRORwWfeiN?p=info (Polymer 2.2.0)
Steps to Reproduce
In attached snaps observe that there is a memory increase
First snapshot is taken initially
Second after replacing innerHTML 40 times (after 1 second each) - see attached PLunker code.
third after 80th time
fourth at 120th time.
In below example click on 'Start Adding' button. It will add innerHTML and replace it after 1 second continuously.
I left this code to run for 30 minutes - Memory heap grew from 50 MB to 150 MB.
Browser used for taking heap snapshot - Chrome - Version 64.0.3276.0 (Official Build) canary (64-bit)
Expected Results
Such change should not leak out memory
Actual Results
Memory usage is growing continously
Browsers Affected
Versions
Please go through the linked plunker code - Polymer v 1.1.4 - Heap taken at 0,40, 80 1nd 120th reset of innerHTML
Please go through the linked plunker code - Polymer v 1.11.0 - Heap taken at 0,40, 80 1nd 120th reset of innerHTML
Please go through the linked plunker code - Polymer v 2.2.0 - Heap taken at 0,40, 80 1nd 120th reset of innerHTML
The text was updated successfully, but these errors were encountered: