-
Notifications
You must be signed in to change notification settings - Fork 491
Memory Leak in IE11 even after refreshing the whole page #541
Comments
I verified this. Seems like to release the memory you need to close all of the IE windows. I tried refreshing manually and the memory leak either isn't there, or doesn't seem as severe. The GC kicks in and handles things. |
@robbecker-wf I tried manual refresh and even reduced the frequency of refreshes and memory usage still increases over time. I have seen the garbage collector not kick in after a lot of refreshes. |
Can you verify/isolate even more for us? Is it the inclusion of the polyfill alone? Is it adding the Polymer import. Is it creating a DOM module (full or empty)? There's a few things on the page that you can probably get rid of to better reduce the test case. |
Both are needed as you cannot just use webcomponent with either polymer or webcomponent polyfill in IE. Also this is the simplest example I created. It has nothing but a dom-module https://github.com/ankurp/polymer-webcomponent-IE-memory-leak/blob/master/index.html#L27 and nothing else on the page that can account for 2-3MB increases on every page refresh. |
@ebidel I removed everything from the page except for a |
@ebidel Also one thing to note is that memory leaks when both scripts are present. If you only include polymer.html or webcomponents polyfill then there is no memory leak but including both will cause a memory leak. |
Any update on this? I have the same memory leak as @ankurp. The most minimal example I'm using is this: <!DOCTYPE html>
<html>
<head>
<script src="https://polygit.org/polymer+:master/components/webcomponentsjs/webcomponents-lite.js"></script>
<link href="https://polygit.org/polymer+:master/components/polymer/polymer-micro.html" rel="import">
</head>
<body>
</body>
</html> My conclusions are so far:
|
@dombre I agree and noticed the same thing. Just including polymer link and webcomponent-lite both together in an empty HTML page causes 2-3MB of memory leak that does not get cleaned up even after several refreshes. Memory is only released when browser or tab is closed. |
In real world applications this gets worse. Of course, it doesn't matter for SPAs but for elements you include in a 'normal' Website this is bad. Here are some examples: Example 1: https://www.polymer-project.org/1.0/ will loose ~40 MB every refresh: Example 2: https://shop.polymer-project.org will loose ~12 MB every refresh: My Test environments are:
For reference, this is the memory consumption of the minimal example #541 (comment) with a 5 secondes refresh rate |
Any update on this? |
@justinfagnani @azakus mentioned they had looked at memory leaks in IE at one point. |
Update: @garlicnation is taking a look at this |
Any updates on this issue? Also is there any quick patch we can use in the mean time as a temporary fix? |
After extensive experimentation, I've determined that this is definitely an IE issue, not a webcomponents issue. It's possible to get IE11 and Edge to leak memory by creating a variety of different platform-provided objects. Reported issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8020622/ I've experimented with a couple of mitigation strategies that show some promise in reducing, if not fixing, this issue. My next step introduce the mitigations into the polymer-element-catalog and determine the effect they have in a real-world application. If one of the patches I come up with has a significant effect, I'll update this bug with it and/or consider patching it into the polyfill until the underlying IE issue is resolved. |
@garlicnation can you give more detail of your approach? We have an application using this via x-tags and even refreshing the page is not releasing memory. I would be happy to test out any patches you have in our app for testing a real life app. |
@garlicnation any chance you could share what platform-provided objects cause the memory leaks? We are currently seeing a similar leak on our site, and are in contact with a support engineer at Microsoft. We're having a hard time clarifying that the issue is a bug in IE though, as opposed to an issue in our code or the webcomponents.js code. |
Would also be interested in details about mitigating this problem now and any updates on a polyfill solution. |
@garlicnation - Can you provide an update on this issue and if you we're able to come up with any work arounds? |
For anyone investigating this, it seems to be related to circular references of some sort, but I'm waiting for more info from Microsoft about this. @garlicnation, I think that we will need a workaround/mitigation available, since even if Microsoft comes up with a patch, it won't get pushed out and applied to end-users very quickly. I also put a workaround in Polymer/polymer#3430 for cases involving a framework like Polymer, where you don't explicitly need HTML imports. |
Any update on this issue, we're having real issues with our call centre applications where a new call triggers a new session using a browser reload with querystring params. Like I said in a previous comment to @garlicnation even a quick post to give use a pointer to where you see this issue arising would be a big help. |
Any news on this? |
I have a fix for this; has to do with the document.implementation. From what I found if you have any non-standard attributes/properties that you are putting on a document, IE will leak. I also have submitted a PR for memory leak fixes with in Polymer (Polymer/polymer#3964). Other things of note, some polymer elements such as paper-dialog will use elements like
this may cause a memory leak as well, so you may want to add an event wrapper on document AND window that will remove the events on page unload (the problem is that when you bind, it creates a new fn reference that IE doesnt know how to clean up - I have attached a very aggressive unload script to this issue(Polymer/polymer#3430) ) Anyway like I said I have a PR ready to go that will fix the memory leak with the imports. I am just waiting for approval to submit a PR. Should be submitted by the end of the week |
Should this get closed? It seems that #644 fixes this - can we have a confirmation? |
@ergo I did a quick check with the latest build from master and was still seeing a memory leak issue. My project doesn't use html imports so i'm not sure the changes in #644 are relevant. @garlicnation in your initial comments you mentioned a couple of mitigation strategies, do you mind sharing more information? |
@kstenson you may want to look at this issue: Polymer/polymer#3430 Things to be aware of, I had to manually clear out the CustomElements.registry on page unload; also it looks like IE has a memory leak issues with root shadow dom nodes. (for example adding properties directly or putting observers on the root nodes) |
@bbsteventill thanks for the link, we aren't using polymer with this lib so we don't have access to CustomElements.registry |
@kstenson CustomElements is the polyfill in webcomponentsjs that adds support for CustomElements; hense why I suspected/hoped that script or parts of it could help you out. |
@bbsteventill ah I thought this was a polymer object built on top, thanks for the pointer I will check it out. |
Hello, Any update on this? |
+1 for an update on this... |
+1 for an update, please... |
1 similar comment
+1 for an update, please... |
We've been using a fork of webcomponentsjs that includes #664 to solve the memory leaks we've been seeing when using Polymer. Since we don't use shadow DOM, this has been fine for us. Also, at this point it's probably not worth patching version 0.7, since 1.0 is out and will be what most of the webcomponentsjs and Polymer devs will be focusing on. I would hope the webcomponentjs devs would look into this on 1.0 (if it's still an issue), since the world is stuck with IE11 as a supported browser until 2020. Of course if anyone has their own patch they'd like to submit, by all means open a PR. |
Is this issue solved in WebComponentsJS v1.x? |
@jhuesos I tested this yesterday and the issue is still there. I was able te reproduce by creating a html document which script includes webcomponentsjs, on every reload it leaks even with an empty body. I tested with webcomponentsjs 1.0.17. |
May also want to track Polymer/polymer#4511 |
Thanks for the issue. It has been a great while since this issue was opened. Sadly, this issue misses a live reproduction with the most recent version of the webcomponents polyfill for us to be able to debug and potentially fix. Versions 1 of the polyfills fix a large amount of issues, probably including this one as well. Please see the CONTRIBUTING.md for guidelines on filing issues. You can start from this jsBin template as a starting point and link it in the issue template under "Live Demo". Feel free to file a new issue following these instructions if you can still reproduce this issue with versions 1 of the polyfills. Thank you! |
Can we implement Garbage collector externally for IE11 using any libraries? I am not sure about this methodology !!! This memory leak issue is not with specific libraries like (Angular, react or any JS), since it is the issue with IE browser, can we use and pure js library to do GC externally? |
I have created a repo to demonstrate this issue. Just refreshing the page with a basic component keeps increasing memory in IE 11 and it never gets released
https://github.com/ankurp/polymer-webcomponent-IE-memory-leak
The text was updated successfully, but these errors were encountered: