Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#9167 closed bug (worksforme)

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: No image "www.cssjs.com/jq6inIE6bug.gif" attached to Ticket #9167 www.cssjs.com/jq6inIE6bug.gif

Change History (5)

comment:1 Changed 9 years ago by dongdongface

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

http://www.cssjs.com/jq6inIE6bug.gif

Last edited 9 years ago by dongdongface (previous) (diff)

comment:2 Changed 9 years ago by addyosmani

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.

comment:3 Changed 9 years ago by 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

comment:4 in reply to:  3 Changed 8 years ago by chris@…

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

comment:5 in reply to:  2 Changed 8 years ago by chris@…

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

Note: See TracTickets for help on using tickets.