Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#7054 closed bug (fixed)

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

Change History (14)

comment:1 Changed 7 years ago by snover

Owner: set to fallingdust
Priority: undecided
Status: newpending

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

comment:2 Changed 7 years ago by fallingdust

Status: pendingnew

Here is the test case on jsfiddle: http://jsfiddle.net/xPNb3/1/

comment:4 Changed 7 years ago by snover

Milestone: 1.4.41.4.5

Retargeting due to severity of 1.4.3 regressions.

comment:5 Changed 7 years ago by snover

Milestone: 1.4.51.4.4

Retargeting for 1.4.4 as per John’s request.

comment:6 Changed 7 years ago by john

Owner: changed from fallingdust to john
Status: openassigned

comment:7 Changed 7 years ago by snover

Milestone: 1.4.41.4.5

Retargeting to next minor release.

comment:8 Changed 7 years ago by dmethvin

Owner: changed from john to dmethvin

comment:10 Changed 7 years ago by Dave Methvin

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

comment:11 Changed 7 years ago by jitter

Milestone: 1.4.51.5

Move fixed tickets to appropriate milestone

comment:12 Changed 5 years ago by dmethvin

#12055 is a duplicate of this ticket.

comment:14 Changed 4 years ago by anonymous

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

Note: See TracTickets for help on using tickets.