Skip to main content

Bug Tracker

Side navigation

#9167 closed bug (worksforme)

Opened May 07, 2011 03:31PM UTC

Closed May 10, 2011 05:38AM UTC

Last modified March 14, 2012 07:01AM UTC

jq1.6 in ie6 memory leak bug

Reported by: dongdongface Owned by:
Priority: undecided Milestone: 1.next
Component: misc Version: 1.6
Keywords: Cc:
Blocked by: Blocking:
Description

test file: jq1.52 and jq1.6

browser: ie6(win)

ie6 default memory state

jq1.52 in ie6 default memory:~22MB

jq1.6 in ie6 default memory:~22MB

ie6 refresh page 10 times after memory state

jq1.52 in ie6 memory:~23MB

jq1.6 in ie6 memory:~30MB (memory leak)

test snap pic:

[[Image(www.cssjs.com/jq6inIE6bug.gif)]]

www.cssjs.com/jq6inIE6bug.gif

Attachments (0)
Change History (5)

Changed May 07, 2011 03:54PM UTC by dongdongface comment:1

_comment0: test file: jq1.52 and jq1.6 \ \ browser: ie6(win) \ \ \ \ ie6 default memory state \ \ jq1.52 in ie6 default memory:~22MB \ \ jq1.6 in ie6 default memory:~22MB \ \ \ \ \ ie6 refresh page 10 times after memory state \ \ jq1.52 in ie6 memory:~23MB \ \ jq1.6 in ie6 memory:~30MB (memory leak) \ \ \ test snap pic: www.cssjs.com/jq6inIE6bug.gif1304783723612682
_comment1: test file: jq1.52 and jq1.6 \ \ browser: ie6(win) \ \ \ ---------------------------------------------- \ ie6 default memory state \ \ jq1.52 in ie6 default memory:~22MB \ \ jq1.6 in ie6 default memory:~22MB \ \ \ \ ---------------------------------------------- \ ie6 refresh page 10 times after memory state \ \ jq1.52 in ie6 memory:~23MB \ \ jq1.6 in ie6 memory:~30MB (memory leak) \ \ ---------------------------------------------- \ test snap pic: www.cssjs.com/jq6inIE6bug.gif1304783925709448
_comment2: test file: jq1.52 and jq1.6 \ \ browser: ie6(win) \ \ \ ---------------------------------------------- \ ie6 default memory state \ \ jq1.52 in ie6 default memory:~22MB \ \ jq1.6 in ie6 default memory:~22MB \ \ \ \ ---------------------------------------------- \ ie6 refresh page 10 times after memory state \ \ jq1.52 in ie6 memory:~23MB \ \ jq1.6 in ie6 memory:~30MB (memory leak) \ \ ---------------------------------------------- \ test snap pic: [[Image(http://www.cssjs.com/jq6inIE6bug.gif)]]1304783977780242

test file: jq1.52 and jq1.6

browser: ie6(win)


ie6 default memory state

jq1.52 in ie6 default memory:~22MB

jq1.6 in ie6 default memory:~22MB


ie6 refresh page 10 times after memory state

jq1.52 in ie6 memory:~23MB

jq1.6 in ie6 memory:~30MB (memory leak)


test snap pic: www.cssjs.com/jq6inIE6bug.gif

[[Image(http://www.cssjs.com/jq6inIE6bug.gif)]]

Changed May 10, 2011 05:38AM UTC by addyosmani comment:2

component: unfiledmisc
resolution: → worksforme
status: newclosed

Thanks for submitting a ticket to the jQuery Project!. I've put together the code you provided here http://jsfiddle.net/jNHh3/1 - it's not really much more than $(document).ready({}), however haven't been able to replicate the memory leak mentioned even with 10 refreshes in IE6.

Simply including jQuery 1.6 in the page is very unlikely to cause memory leaks and as there isn't any real additional logic going on in your test, I'm more likely to think that the memory spike in the 1.6 test is due to excessively fast refreshing, where IE may be still attempting some level of garbage collection before being asked to render the same page again.

With that in mind, we'll be closing this ticket, however if you can provide any additional stats or tests that can help us reproduce the issue, we'll happily re-investigate. There are a number of tools designed just for the purpose of IE memory leak detection and some provide a little more reporting which would also be useful to look at.

Changed May 17, 2011 02:41PM UTC by nonos comment:3

I've got the same problem under IE6.

Simply including jQuery 1.6 causes memory leaks (you can see it with Drip).

Can you reopen it please ?

Sincerely,

Nonos

Changed August 19, 2011 04:37PM UTC by chris@theguidrys.us comment:4

Hi guys, please reopen this ticket, since I've actually got a fix for this:

At the very end of the jQuery.support setup (around lines 1137-1373 in my copy of jquery-1.6.1.js), simply null out the enclosed variables that are holding the temporary DOM references:

	
    // CAG 2011.08.19: clean up temporary DOM elements
    body = null;
    div = null;
    documentElement = null;
    all = null;
    a = null;
    select = null;
    opt = null;
    input = null;
    marginDiv = null;
    fragment = null;
    body = null;
    bodyStyle = null;
    tds = null;
    events = null;
    // end patch

    return support;
})();

Using Drip, I've confirmed that the leak in IE6 exists in an unpatched jQuery 1.6.1, and that the leaked DOM references are exactly the elements created during the jQuery.support setup. With the patch above to null out all those enclosed variables, the leak goes away.

Thanks!

Chris

Replying to [comment:3 nonos]:

I've got the same problem under IE6. Simply including jQuery 1.6 causes memory leaks (you can see it with Drip). Can you reopen it please ? Sincerely, Nonos

Changed August 19, 2011 04:47PM UTC by chris@theguidrys.us comment:5

Hi, addyosmani,

This bug is definitely reproducible by only including jQuery 1.6.1 in a page and not invoking any jQuery code directly. The thing is that it appears you need a specific version of IE6. I know, I know, IE6 is dead, except it actually isn't. My application must run on the version of IE6 included on Windows CE 5 (sigh, horrible, I know) which exhibits this problem, but I'm also reproducing this quite easily on a clean non-updated VM of Windows XP with IE6. The only additional software I've installed is Drip, but I haven't updated the browser at all from the stock version on Windows XP.

Please see my patch above and consider it. It's totally harmless in any other browser, allows for some more eager garbage collection, and most importantly, fixes a very atrocious memory leak (one that causes the entire document to be leaked between refreshes) in IE6.

This is the entire test case that I'm running through Drip to reproduce this:

<html>
    <head>
        <script type="text/javascript" src="../media/libraries/jquery-1.6.1.js"></script>
    </head>
    <body>
    </body>
</html>

Thanks!

Chris

Replying to [comment:2 addyosmani]:

Thanks for submitting a ticket to the jQuery Project!. I've put together the code you provided here http://jsfiddle.net/jNHh3/1 - it's not really much more than $(document).ready({}), however haven't been able to replicate the memory leak mentioned even with 10 refreshes in IE6. Simply including jQuery 1.6 in the page is very unlikely to cause memory leaks and as there isn't any real additional logic going on in your test, I'm more likely to think that the memory spike in the 1.6 test is due to excessively fast refreshing, where IE may be still attempting some level of garbage collection before being asked to render the same page again. With that in mind, we'll be closing this ticket, however if you can provide any additional stats or tests that can help us reproduce the issue, we'll happily re-investigate. There are a number of tools designed just for the purpose of IE memory leak detection and some provide a little more reporting which would also be useful to look at.