Bug Tracker

Ticket #7054 (closed bug: fixed)

Opened 4 years ago

Last modified 13 months ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by snover

  • Owner set to fallingdust
  • Priority set to undecided
  • Status changed from new to pending

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

comment:2 Changed 4 years ago by fallingdust

  • Status changed from pending to new

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

comment:3 Changed 4 years ago by snover

  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Version changed from 1.4.2 to 1.4.3
  • Milestone changed from 1.4.2 to 1.next

comment:4 Changed 4 years ago by snover

  • Milestone changed from 1.4.4 to 1.4.5

Retargeting due to severity of 1.4.3 regressions.

comment:5 Changed 4 years ago by snover

  • Milestone changed from 1.4.5 to 1.4.4

Retargeting for 1.4.4 as per John’s request.

comment:6 Changed 4 years ago by john

  • Owner changed from fallingdust to john
  • Status changed from open to assigned

comment:7 Changed 4 years ago by snover

  • Milestone changed from 1.4.4 to 1.4.5

Retargeting to next minor release.

comment:8 Changed 4 years ago by dmethvin

  • Owner changed from john to dmethvin

comment:10 Changed 4 years ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

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 4 years ago by jitter

  • Milestone changed from 1.4.5 to 1.5

Move fixed tickets to appropriate milestone

comment:12 Changed 2 years ago by dmethvin

#12055 is a duplicate of this ticket.

comment:13 Changed 22 months ago by thorn.mailbox@…

comment:14 Changed 13 months 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.