Skip to main content

Bug Tracker

Side navigation

#7054 closed bug (fixed)

Opened September 20, 2010 01:10PM UTC

Closed January 09, 2011 10:26PM UTC

Last modified November 07, 2013 06:41AM UTC

Memory leaks when bind custom event in IE8

Reported by: fallingdust Owned by: dmethvin
Priority: blocker Milestone: 1.5
Component: event Version: 1.4.3
Keywords: memory leak Cc:
Blocked by: Blocking:
Description

In jQuery, when binding a custom event, i.e., 'abc' in IE8, and then remove the element by calling remove(). attachEvent and detachEvent will be called. But actually detachEvent won't break the reference chain, the memory leaks...

Also, the following code leaks in IE8:

function testLeak(){

var div = document.createElement('div');

div.innerHTML = new Array(1000).join(new Array(1000).join('x'));

var handler = function(){

};

div.attachEvent('onabc', handler);

div.detachEvent('onabc', handler);

}

setInterval(testLeak, 1000);

Attachments (0)
Change History (14)

Changed October 14, 2010 09:58PM UTC by snover comment:1

owner: → fallingdust
priority: → undecided
status: newpending

Please provide a link to a live test case demonstrating this issue.

Changed October 16, 2010 06:44PM UTC by fallingdust comment:2

status: pendingnew

Here is the test case on jsfiddle:

http://jsfiddle.net/xPNb3/1/

Changed October 16, 2010 08:34PM UTC by snover comment:3

Changed October 21, 2010 10:56PM UTC by snover comment:4

milestone: 1.4.41.4.5

Retargeting due to severity of 1.4.3 regressions.

Changed October 22, 2010 05:53AM UTC by snover comment:5

milestone: 1.4.51.4.4

Retargeting for 1.4.4 as per John’s request.

Changed October 23, 2010 07:21PM UTC by john comment:6

owner: fallingdustjohn
status: openassigned

Changed October 28, 2010 02:09AM UTC by snover comment:7

milestone: 1.4.41.4.5

Retargeting to next minor release.

Changed December 31, 2010 05:17PM UTC by dmethvin comment:8

owner: johndmethvin

Changed December 31, 2010 05:39PM UTC by dmethvin comment:9

Changed January 09, 2011 10:26PM UTC by Dave Methvin comment:10

resolution: → fixed
status: assignedclosed

Ensure that the DOM element ref in an event handler is removed by cleanData to avoid an IE6/7/8 memory leak. Fixes #7054.

Changeset: fcf623786aeae20485e5253bd2b66c8758053646

Changed January 14, 2011 10:20PM UTC by jitter comment:11

milestone: 1.4.51.5

Move fixed tickets to appropriate milestone

Changed July 11, 2012 02:28PM UTC by dmethvin comment:12

#12055 is a duplicate of this ticket.

Changed February 11, 2013 11:34AM UTC by thorn.mailbox@gmail.com comment:13

Changed November 07, 2013 06:41AM UTC by anonymous comment:14

+1, this isn't fixed, the issue is leftover anonymous functions and closure from event handling.