atom feed22 messages in com.googlegroups.jquery-en[jQuery] Memory leaks forever
FromSent OnAttachments
Franck MarciaMar 25, 2006 7:13 am 
Dave MethvinMar 25, 2006 8:55 am 
Franck MarciaMar 25, 2006 9:08 am 
John ResigMar 25, 2006 9:15 am 
Dave MethvinMar 25, 2006 10:07 am 
Michael GearyMar 25, 2006 10:07 am 
Franck MarciaMar 25, 2006 10:39 am 
Michael GearyMar 25, 2006 10:56 am 
Dave MethvinMar 25, 2006 11:05 am 
Franck MarciaMar 25, 2006 1:45 pm 
Michael GearyMar 25, 2006 2:19 pm 
Franck MarciaMar 25, 2006 5:16 pm 
Dave MethvinMar 26, 2006 9:02 am 
Michael GearyMar 26, 2006 1:24 pm 
Franck MarciaMar 28, 2006 2:25 am 
Dave MethvinMar 28, 2006 5:45 am 
John ResigMar 28, 2006 7:30 am 
Franck MarciaMar 28, 2006 8:26 am 
jqu...@vikas.mailshell.comMar 28, 2006 8:57 am 
John ResigMar 28, 2006 9:03 am 
Michael GearyMar 28, 2006 9:14 am 
jqu...@vikas.mailshell.comMar 28, 2006 9:24 am 
Subject:[jQuery] Memory leaks forever
From:Franck Marcia (fran@gmail.com)
Date:Mar 25, 2006 10:39:39 am
List:com.googlegroups.jquery-en

First, thanks everybody.

Yes, John, I use empty() before filling the list.

I tried to use Doug's code but it failed: very (very) long on IE and more memory consumption (!)

I adapted the code because it didn't seem to work with the way events are handled.

Here's what I tried (in jquery.js).

function $(a,c) { ... var self = { ... remove: function() { this.each(function(){ purgeEvents(this); this.parentNode.removeChild(this);}); this.cur = []; return this; }, ... empty: function() { return this.each(function(){ purgeEvents(this, false); while (this.firstChild) this.removeChild(this.firstChild); }); }, ... }; ... };

// from http://crockford.com/javascript/memory/leak.html function purgeEvents(elt, me) { if (me) for (var i in elt) try { // prevent an exception on FF if (typeof elt[i] === 'function' && i.indexOf('on') == 0) // try to skip other functions elt[i] = null; } catch(e) {} if (a = elt.childNodes) for (var i = 0, l = a.length; i < l; ++i) purgeEvents(elt.childNodes[i], true); };

and I call it one last time on unload document : window.onunload = function() { purgeEvents(document, true); };

I'm going to try Michael's patch.

Franck.