Skip to main content

Bug Tracker

Side navigation

#8863 closed bug (fixed)

Opened April 13, 2011 04:41PM UTC

Closed May 25, 2011 06:40PM UTC

Last modified June 06, 2011 08:49AM UTC

Memory leaks in IE(6/7/8) when refreshing a frame, which is in a frameset and includes latest jQuery (v.1.5.2)

Reported by: Simeon Panayotov Owned by:
Priority: high Milestone: 1.next
Component: support Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

If jQuery is included in a frame in a frameset and the given frame is refreshed repeatedly, the browser (IE6/7/8) leaks memory. The leak is approximately 1MB per click. The bigger the page, the bigger the leak. I have tested this also with IEJSLeaksDetector, which shows that the window object is a possible leak (which would explain the size of the leak, provided the fact that there is only jQuery on the page.

I suspect this issue is the same as http://bugs.jquery.com/ticket/6421 and since the latter is closed I am opening a new ticket.

Below is the code of a three different pages: one with frameset with two frames, one with a link, hosted in the first frame, and a third one, hosted in the second frame. When the link is clicked the content of the second frame, containing jQuery, is refreshed.

main.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
            "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
    <frameset cols="50%,50%*" border="0" frameborder="1" framespacing="1">
        <frame src="link.html" scrolling="no" frameborder="0" noresize="yes" />
        <frame name="jqueryhost" src=""	scrolling="no" frameborder="0" noresize="yes" />
    </frameset>
</head>
<body>

</body>
</html>

link.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
</head>
<body>
    <a href="jqueryhost.html" target="jqueryhost">load jQuery in a frame"</a>
</body>
</html>

jqueryhost.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
</head>
<body>
    jQuery Host
</body>
</html>

I hope this helps you reproduce the issue.

Attachments (0)
Change History (21)

Changed April 13, 2011 05:33PM UTC by anonymous comment:1

We have the same problem.

Changed April 17, 2011 11:05PM UTC by john comment:2

resolution: → patchwelcome
status: newclosed

This is almost certainly an issue with Internet Explorer (obviously) but it's not obvious what the issue is (especially since jQuery simply existing is causing the problem). This is a case where we're going to have to defer to someone that wants to investigate and provide a patch.

Changed April 18, 2011 02:56PM UTC by timmywil comment:3

#8874 is a duplicate of this ticket.

Changed May 03, 2011 05:24PM UTC by dossy comment:4

_comment0: Experiencing this same memory leak problem on HP t5510 thin clients running WinCE .NET 4.2's IE6.1304443541338358

Experiencing this same memory leak problem on HP t5510 thin clients running WinCE .NET 4.2's IE6. Reliably reproducible memory leak with jQuery 1.5.2, but jQuery 1.4.4 works fine.

Changed May 03, 2011 10:37PM UTC by anonymous comment:5

Also seeing this issue. Selenium (which uses a frameset) slows to a crawl by simply including jQuery > 1.4.4 in the app under test.

Sad to see the reaction that this is simply an IE bug when it works fine with jQuery v1.4.4. Unfortunately that means my team will be stuck on this version.

Changed May 03, 2011 11:14PM UTC by rwaldron comment:6

Sad to see the reaction that this is simply an IE bug when it works fine with jQuery v1.4.4. Unfortunately that means my team will be stuck on this version.

"Patchwelcome" does not mean "wontfix", feel free to contribute a patch to the github repo if you are able to solve this issue. Thanks!

Changed May 16, 2011 09:23AM UTC by romero83@freemail.hu comment:7

I created a simple frameset doc to test this issue in IE7.

I also reproduced this issue with Jquery 1.5.1 and above even with version 1.6.1, but not with Jquery 1.5.0. It seems something happened in the Jquery 1.5.1 patch. Maybe it helps.

Changed May 16, 2011 09:36AM UTC by romero83@freemail.hu comment:8

Moreover with Jquery 1.5.1 RC1 still working and detect no issue in frameset doc with IE7.

The problem appears in the final version of Jquery 1.5.1 and above.

Changed May 16, 2011 10:17AM UTC by romero83@freemail.hu comment:9

Ok. So most probably I found the problem.

Let's see Jquery 1.5.1 source code for example.

The problematic code line is 1106, which looks like this:

input = div.getElementsByTagName("input")[0];

I don't know why, but if you add this statement into a variable, then IE do this kind of memory issue.

I tried to avoid this variable so I replaced 'input' variable with inline call where it was used.

So I replaced on code line 1145

checkOn: input.value === "on",

to

checkOn: div.getElementsByTagName("input")[0].value === "on",

And code line 1163-1164:

input.checked = true;
jQuery.support.noCloneChecked = input.cloneNode( true ).checked;

to

div.getElementsByTagName("input")[0].checked = true;
jQuery.support.noCloneChecked = div.getElementsByTagName("input")[0].cloneNode( true ).checked;

And it worked. No more redundant memory consumption in IE7 and I think other IE versions. :)

Changed May 19, 2011 03:20PM UTC by Booab comment:10

Thanks romero83 for the input but it doesn't solve the problem for me :-(

Also jQuery 1.4.4 is not working fine for me I also get a memory leak of about 1Mb per load.

Any other ideas or a solution coming up from jQueries side?

Changed May 20, 2011 11:11AM UTC by petnys comment:11

_comment0: romero83, an easier fix would be to clear the "input" variable on line 1313, where the other variables declared in the same place is set to null. I have successfully tested this change: \ \ // release memory in IE \ div = all = a = input = null;1305889904727875
_comment1: romero83, an easier fix would be to clear the "input" variable on line 1313, where the other variables declared in the same place is set to null. I have successfully tested this change: \ \ div = all = a = input = null;1305892192899596

romero83, an easier fix would be to clear the "input" variable on line 1313, where the other variables declared in the same place is set to null. I have successfully tested this change:

div = all = a = input = null;

The same type of fix also seems to be successful in jQuery 1.6.1, however that version declares a lot more variables in the support function.

Changed May 25, 2011 02:56PM UTC by anonymous comment:12

So, how to fix this problem???

Changed May 25, 2011 03:29PM UTC by timmywil comment:13

component: unfiledsupport
priority: undecidedhigh

I think we should null the support vars.

Changed May 25, 2011 04:39PM UTC by ch. comment:14

I have a leak over 1 Megabyte by 1 page reload !!! O_o

Changed May 25, 2011 04:52PM UTC by timmywil comment:15

@ch. then it isn't jQuery

Changed May 25, 2011 06:40PM UTC by timmywil comment:16

resolution: patchwelcome
status: closedreopened

Changed May 25, 2011 06:40PM UTC by timmywil comment:17

resolution: → fixed
status: reopenedclosed

Null created elements in support to avoid leaks in IE. Tested IE6-8. Leaks are contained to the byte. Fixes #9294.

Changeset: 657b197c193335899703fc158b153e2475cca539

Changed May 27, 2011 08:40AM UTC by Booab comment:18

Thanks for your proposed solution but unfortunately it's not solving the problem in IE (still about 1Mb of leak)

Changed May 27, 2011 08:40AM UTC by Booab comment:19

In IE6 that is

Changed May 27, 2011 03:37PM UTC by timmywil comment:20

@Booab There are no leaks in the support module in IE6 according to my tests. Do you have a test case I could view? Also, you are testing against the git version of jQuery correct?

Changed June 06, 2011 08:49AM UTC by Booab comment:21

@timmywil

I added the source as described in the changeset manually to the versions of jQuery I'm testing on (1.4.4, 1.5.1, 1.6.1). Or is this not the way it should be done? I don't see a way to download the jQuery file with your changes in it, so I assume the manual way is correct?

I'll post my source once you acknowledge my way of working, if not I will test again with your suggestions (if I can download the full patch jQuery file).