Ticket #1285 (closed bug: invalid)
Draggable IE memory leak
| Reported by: | xoid | Owned by: | stefan |
|---|---|---|---|
| Priority: | major | Milestone: | 1.1.3 |
| Component: | interface | Version: | 1.1.2 |
| Keywords: | Draggable IE memory leak | Cc: | |
| Blocking: | Blocked by: |
Description
When creating simple draggable element using Draggable(), memory leak detected for the draggable element itself and draghelper element. Found using drip detector: http://jgwebber.blogspot.com/2005/05/drip-ie-leak-detector.html http://www.outofhanwell.com/ieleak/Drip-0.5.exe
Change History
comment:2 Changed 5 years ago by scott.gonzal
- Status changed from new to closed
- Resolution set to wontfix
Interface is no longer supported; consider switching to jQuery UI.
comment:3 Changed 5 years ago by Olsa
- Status changed from closed to reopened
- Resolution wontfix deleted
I have the same problem with an application where I use ui.draggables/ui.dropples and replace the draggables via AJAX.
Everytime after replacing or just removing the content, the Tool Drip (mentioned by xoid above) tells me that the event-bindings of the dom nodes still exist.
I'm not able to remove the event-bindings. Neither with droppable("destroy") nor with $("*").unbind().
Is there a memory leak or am I doing something wrong?
The Test-Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ui.jquery.com/repository/
latest/jquery-1.2.6.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/repository/
latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/repository/
latest/ui/ui.droppable.js"></script>
<script type="text/javascript" src="http://ui.jquery.com/repository/
latest/ui/ui.draggable.js"></script>
<script type="text/javascript">
$(function(){
$("#draggable").draggable();
$("#droppable").droppable({
accept: "#draggable",
drop: function(ev, ui) {
alert("dropped");
}
});
$("#removeIt").click(function(){
//$("*").unbind();
$("#draggable").draggable("destroy");
$("#droppable").droppable("destroy");
$("#draggable").remove();
});
});
</script>
<style type="text/css">
#droppable,
#draggable{
position:absolute;
top:100px;
left:400px;
width:200px;
height:200px;
background-color:#CCFFCC;
border:1px solid #f00;
}
#draggable{
z-index:1;
left:100px;
background-color:#FFCC66;
}
</style>
</head>
<body>
<a href="#" id="removeIt">Remove Draggable</a>
<div id="draggable">Draggable</div>
<div id="droppable">Droppable</div>
</body>
</html>
comment:4 Changed 5 years ago by flesler
- Status changed from reopened to closed
- Resolution set to invalid
Please repost this to the UI Bug Tracker.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

suggested patch:
--- interface 1.2/source/idrag.js 2007-02-08 09:13:48.000000000 -0500 +++ interface-1.2/source/idrag.js 2007-06-08 19:06:43.000000000 -0400 @@ -61,6 +61,11 @@ { if (this.isDraggable) { this.dragCfg.dhe.unbind('mousedown', jQuery.iDrag.draginit); + this.dragCfg.dhe.each( + function(){ + this.dragElem = null; + } + ); this.dragCfg = null; this.isDraggable = false; if(jQuery.browser.msie) { @@ -70,6 +75,10 @@ this.style.KhtmlUserSelect = ''; this.style.userSelect = ''; } + if (window.ActiveXObject) { + this.onselectstart = null; + this.ondragstart = null; + } } } );