[code]this._setAutoResize=function(){
if (this._realfake) return;
var el = window;
var self = this;
dhtmlxEvent(window,"resize",function(){
window.clearTimeout(self._resize_timer);
if (self._setAutoResize)
self._resize_timer=window.setTimeout(function(){
if (self.setSizes)
self.setSizes();
if (self._fake && self._fake._correctSplit)
self._fake._correctSplit();
}, 100);
});
//prevent multiple initializations
this._setAutoResize = function(){};
}[/code]
above code in file dhtmlxgrid.js, line 723, there are two memory leaks:
first: above resize event never be detached, and the self reference the datagrid will never be released, although the datagrid’s members all set null, this still is a small memory leak.
second: when call splitAt, there has a line code: this._fake=new dhtmlXGridObject(leftBox); this._fake will call _setAutoResize and then call dhtmlxEvent(window,“resize”,function() and will never be released, because this._fake._realfake is not set true when this._fake call his._setAutoResize, this._fake._realfake is set to true after the this._fake call his._setAutoResize, this is too late, so this._fake is referenced by the self reference and will never be released and will error on every window’s resize event, because the fake will call self._fake._correctSplit(); but _correctSplit is null. this is a big memroy leak.