Bug Tracker

Opened 17 years ago

Closed 14 years ago

Last modified 11 years ago

#186 closed bug (fixed)

IE memory leak

Reported by: manoloweb@… Owned by:
Priority: undecided Milestone:
Component: ajax Version:
Keywords: memory leak Cc: &#34
Blocked by: Blocking:


Use the full jquery library in a page, and the IE memory usage starts running up every time the page is refreshed. Even if you don't use any jquery functions at all.

Change History (12)

comment:1 Changed 17 years ago by Steve O

I can confirm this, it seems to jump by anywhere from 100K to 300K every refresh.

comment:2 Changed 17 years ago by anonymous

This is a BIG deal-breaker for me. I can not faithfully use this framework with such a large memory leak occuring so consistently.

comment:3 Changed 17 years ago by joern

Maybe we should try to include MGs closure plugin into the jQuery core...

comment:4 Changed 17 years ago by anonymous

please fix this ASAP. No library worth the name should be afflicted with the notorious IE memory leak. I agree with joern: use the closure plugin or something similar. The codebase isn't that big, someone should be able to do this in no-time!

comment:5 Changed 17 years ago by Steve O

I did some testing to try to isolate this leak in the code. I am using Rev 413 and my steps to reproduce look like this: (1) create a basic HTML page linking to the jquery code as normal, and (2) refreshing the page consecutive times in IE6 and monitoring the memory usage in the process monitor in the Windows Task Manager. There is no jquery code in the file except including the library itself. Refreshing the page causes a memory increase of 100-300K for every refresh.

In order to stop the leak, I have to comment out BOTH of the following:

1221: jQuery.fn[o] = function(f){ 1222: return f ? this.bind(o, f) : this.trigger(o); 1223: };

  • AND -

1291: jQuery.event.add( window, "load", jQuery.ready );

If I only comment one out and not the other, the leak still happens. If I remove both of them from the code, the leak stops.

I hope this helps someone figure this one out... I will continue to try, but my JS event knowledge is next to nothing. I imagine that this bug is stopping quite a few people from embracing JQuery in production code, like it is at my company. It will be great to see this one squashed.

comment:6 Changed 17 years ago by anonymous

I did a little more digging and it turns out that I was able to stop the leak by commenting out JUST line 917: element+ type? = this.handle; (which is in jQuery.event.add).

Further tweaking led me to the jQuery.event.handle function and subsequently to the jQuery.event.fix function. If I comment out lines 991 - 997 in Rev 413 (the assignment of preventDefault and stopPropagation functions) then the leak stops.

So, maybe the leak is being caused because those two functions are being attached to the event object?

comment:7 Changed 17 years ago by Steveo O

OK... more digging. My testing showed that if you loop through every event that has been added via jQuery.event.add and set the event's properties preventDefault and stopPropagation to null when the page unloads (I personally did this in the IE cleanup function starting on line 1296 in Rev 413), then there is no leak. I am not sure if this is safe to do or not--but it appears to stop the leak.

I don't really have a patch... I am not really sure how to create one, but I hope this information helps someone!


comment:8 Changed 17 years ago by anonymous

Component: core
Owner: changed from anonymous to john
Priority: major
Type: bug

comment:9 Changed 17 years ago by brandon

Owner: changed from john to anonymous
Status: newassigned

Thanks Steveo O for all the testing ... I'm going to try this out myself and get a patch together.

comment:10 Changed 17 years ago by brandon

Resolution: fixed
Status: assignedclosed

Steveo O, you testing has been invaluable ... thanks again! This is now fixed in SVN revision 520.

http://brandon.jquery.com/test/186/186.html http://brandon.jquery.com/test/

comment:11 Changed 17 years ago by Steve O

Brandon, Many thanks, this one really helps out.


comment:16 Changed 14 years ago by dmethvin

Component: ajax
need: Review
Priority: blocker
Resolution: fixed
Status: reopenedclosed
Type: bug

Reopened by spammer.

Note: See TracTickets for help on using tickets.