UI Tabs memory leaks in IE6
I'm finding several memory leaks in IE6 due to jQuery UI's Tabs
plugin. Has anyone else seen this?
I'm using Sieve, and leaks are reported on each tab container UL, and
each tab LI, A, and tab container DIV.
I traced the issue to several vars set in closures that are never
cleaned up. Also, the event handlers are never unbound.
Here's what I cleaned up:
1) In $.fn.tabsSelected :
Set $li = null, as follows:
$.fn.tabsSelected = function() {
var selected = -1;
if (this[0]) {
var instance = $.ui.tabs.getInstance(this[0]),
$lis = $('li.' + instance.options.tabClass, this);//
Dell custom
selected = $lis.index( $lis.filter('.' +
instance.options.selectedClass)[0] );
$lis = null;// memory leak clean-up
}
return selected >= 0 ? ++selected : -1;
};
2) In tabify > if (init) { block
Set $lis = null at the end of the if (init) block.
3) End of tabify:
Add unload event and clean up:
$(window).unload(function () {
self.$tabs.unbind(o.event, tabClick);
self.$tabs = null;
self.$containers = null;
});
After doing this, no more leaks in IE6.