I've fixed the issue with jQuery.event.remove not unbinding namespaced events but had a very difficult time getting reliable results when testing the memory leak. Please test r6321 and let me know if this fixes the memory leak for you. -- Brandon Aaron
On Sat, Apr 25, 2009 at 3:09 PM, Mike Park <[email protected]> wrote: > > new thread, as requested (original message below): > ------- > > There is definitely a problem with the way jQuery (I'm using 1.3.2) > handles cleaning up namespaced events (I'm tracing the 'unload' event > codepath). The problem from what I can tell seems to be in > jQuery.event.remove: > > 2540 // Handle multiple events seperated by a space > 2541 // jQuery(...).unbind("mouseover mouseout", fn); > 2542 jQuery.each(types.split(/\s+/), function(index, type){ > 2543 // Namespaced event handlers > 2544 var namespaces = type.split("."); > 2545 type = namespaces.shift(); > 2546 var namespace = RegExp("(^|\\.)" + namespaces.slice > ().sort().join(".*\\.") + "(\\.|$)"); > > ...during the 'unload' event-handler codepath, this code snippet here > is expecting the passed in 'types' argument to contain the namespaced > event-identifier (ex. 'click.foo'), but instead it is getting the > common event-identifier instead (ex. 'click'). > > You can firebug-trace this yourselves with the simple examples I put > up here: > http://emparq.com/ex/ex-good.html > http://emparq.com/ex/ex-bad.html > > ...you'll notice the only difference between these two examples is > that one binds 'click.foo' and the other binds 'click'. In the bad > example, hitting reload constantly will see the process memory useage > go up (in essense, a leak) due to 'jQuery.event.remove' not properly > cleaning up the namespaced 'click.foo' event), while the good example > will not suffer the same results. > > I'm still new-ish to jQuery and I'm not ready to hazard a solution > just yet, but I'm guessing something either needs to be done with the > way 'jQuery.event.remove' handles the value of the 'types' argument, > or this code here: > > 2531 for ( var type in events ) > 2532 this.remove( elem, type + (types || "") ); > > ...needs to be modified to properly put those namespaced suffixes back > into the second argument. I'm not familiar enough with all of the use- > cases that this function handles, so I don't know which is the best > approach. > > Can anyone else shed some light on this subject? > > > --Mike > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
