#9341 closed bug (fixed)
IE7/IE9 memory leak creating cacheable HTML fragments
Reported by: | shghs | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | core | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Calling the jQuery function with an HTML string that is not matched by rsingleTag leads to a memory leak in IE7 and IE9.
Steps to reproduce:
- Restart Windows.
- Run the task manager (Ctrl+Alt+Del) and switch to the process tab.
- Run IE and load the attached test case.
Result: iexplore.exe's memory usage linearly increases. On my machine, it uses 16 MB after the first page load, and over 100 MB after 2 minutes.
This affects:
- IE 7.0.5730.11 on Windows XP SP3
- IE 9.0.8112.16421 on Windows 7 x64 SP1
both running in VMware Fusion. The memory leak is not present in jQuery 1.5.
Change History (12)
comment:1 Changed 11 years ago by
comment:2 follow-up: 4 Changed 11 years ago by
On further testing, it looks like even jQuery('<div>')
leaks in IE7. IE9 needs an HTML string that isn't matched by rsingleTag, so maybe these are actually two separate bugs?
comment:3 Changed 11 years ago by
Component: | unfiled → core |
---|---|
Priority: | undecided → high |
Resolution: | → patchwelcome |
Status: | new → closed |
Avoiding leaks is important, but we probably won't be able to invest resources in fixing this. Regardless, patches are welcome if the source of the leak can be discovered.
comment:4 follow-up: 7 Changed 11 years ago by
Replying to shghs:
On further testing, it looks like even
jQuery('<div>')
leaks in IE7. IE9 needs an HTML string that isn't matched by rsingleTag, so maybe these are actually two separate bugs?
I did some investigation, i think there is a memory leak with $.support in ie7 which may be causing the jQuery('div') leak, hopefully get some time to write up a test case for that.
comment:5 Changed 11 years ago by
Resolution: | patchwelcome |
---|---|
Status: | closed → reopened |
I predicted this.
We used to null
all elements and those elements' outerHTML that were created in the support tests, then the nulling was removed. Looks like it needs to be re-added.
comment:6 Changed 11 years ago by
Owner: | set to Rick Waldron |
---|---|
Status: | reopened → assigned |
comment:7 Changed 11 years ago by
Replying to [email protected]…:
I did some investigation, i think there is a memory leak with $.support in ie7 which may be causing the jQuery('div') leak, hopefully get some time to write up a test case for that.
Yes you're right. IE7 has a separate memory leak due to #8873 which is reproducable just by including jQuery and no other JavaScript.
So I think this bug actually only affects IE9 and I flagged IE7 prematurely.
comment:8 Changed 11 years ago by
I've submitted a pull request here: https://github.com/jquery/jquery/pull/389
and also raised a ticket on IE's bugtracker: https://connect.microsoft.com/IE/feedback/details/670128/memory-leak-related-to-documentfragment-prototype-queryselectorall
comment:10 follow-up: 11 Changed 11 years ago by
@dmethvin - I think there is some confusion, shghs didn't find that, he filed that. I'm following the ticket now to see if there is any action. Seems odd that we're just now getting reports of this leak. My biggest concern is compromising performance for all UAs over a phantom
comment:11 Changed 11 years ago by
Replying to rwaldron:
My biggest concern is compromising performance for all UAs over a phantom
The line of code in question is only reached in IE8 and IE9.
I agree it's odd that this leak hasn't been reported before. It's existed since 1.5.2, but it would probably be a good idea to do some more comprehensive testing in case this bug is unique to my VM environment.
comment:12 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Landing pull request 389. Null elements in clone to avoid memory leak in IE. Fixes #9341.
More Details:
Test case: http://jsfiddle.net/nGs5t/