#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
| Owner: | set to fallingdust |
|---|---|
| Priority: | → undecided |
| Status: | new → pending |
comment:2 Changed 7 years ago by
| Status: | pending → new |
|---|
Here is the test case on jsfiddle: http://jsfiddle.net/xPNb3/1/
comment:3 Changed 7 years ago by
| Milestone: | 1.4.2 → 1.next |
|---|---|
| Priority: | undecided → blocker |
| Status: | new → open |
| Version: | 1.4.2 → 1.4.3 |
comment:4 Changed 7 years ago by
| Milestone: | 1.4.4 → 1.4.5 |
|---|
Retargeting due to severity of 1.4.3 regressions.
comment:5 Changed 7 years ago by
| Milestone: | 1.4.5 → 1.4.4 |
|---|
Retargeting for 1.4.4 as per John’s request.
comment:6 Changed 7 years ago by
| Owner: | changed from fallingdust to john |
|---|---|
| Status: | open → assigned |
comment:8 Changed 7 years ago by
| Owner: | changed from john to dmethvin |
|---|
comment:10 Changed 7 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
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
| Milestone: | 1.4.5 → 1.5 |
|---|
Move fixed tickets to appropriate milestone
comment:13 Changed 4 years ago by
It isn't fixed. See the test case here: http://www.nesterovsky-bros.com/weblog/2013/02/10/jquerysTickets7054ClosedBugFixed.aspx
comment:14 Changed 4 years ago by
+1, this isn't fixed, the issue is leftover anonymous functions and closure from event handling.

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