Skip to main content

Bug Tracker

Side navigation

#9341 closed bug (fixed)

Opened May 19, 2011 02:34AM UTC

Closed May 25, 2011 07:19PM UTC

Last modified March 14, 2012 06:30AM UTC

IE7/IE9 memory leak creating cacheable HTML fragments

Reported by: shghs Owned by: rwaldron
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:

1. Restart Windows.

2. Run the task manager (Ctrl+Alt+Del) and switch to the process tab.

3. 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.

Attachments (0)
Change History (12)

Changed May 19, 2011 02:39AM UTC by shghs comment:1

Changed May 19, 2011 02:58AM UTC by shghs comment:2

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?

Changed May 24, 2011 01:32AM UTC by timmywil comment:3

component: unfiledcore
priority: undecidedhigh
resolution: → patchwelcome
status: newclosed

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.

Changed May 24, 2011 02:37AM UTC by jwyles@atlassian.com comment:4

Replying to [comment:2 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.

Changed May 24, 2011 03:02AM UTC by rwaldron comment:5

resolution: patchwelcome
status: closedreopened

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.

Changed May 24, 2011 03:02AM UTC by rwaldron comment:6

owner: → rwaldron
status: reopenedassigned

Changed May 24, 2011 03:56AM UTC by shghs comment:7

Replying to [comment:4 jwyles@…]:

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.

Changed May 24, 2011 10:13AM UTC by shghs comment:8

Changed May 24, 2011 12:59PM UTC by dmethvin comment:9

_comment0: Nice detective work, shgs!1306242005612604

Nice detective work, shghs!

Changed May 24, 2011 04:54PM UTC by rwaldron comment:10

@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

Changed May 25, 2011 01:37AM UTC by shghs comment:11

Replying to [comment:10 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.

Changed May 25, 2011 07:19PM UTC by Scott Hughes comment:12

resolution: → fixed
status: assignedclosed

Landing pull request 389. Null elements in clone to avoid memory leak in IE. Fixes #9341.

More Details:

Changeset: 287156197f296fcbcb8be11aa8ce6f1b819aeda6