Has anyone gotten any farther with memory
reclemation in IE?
I added a destroy() method to the dynlayer
object.
See end of this doc for the results of
testing..
I then placed a call in
DynLayer.prototype.deleteAllChildren=function()
{
for (var i in this.children)
{
this.children[i].deleteAllChildren();
this.children[i].invokeEvent('delete');
DynAPI.removeFromArray(this.dyndoc.all,this.children[i],true);
if (is.ns && this.children[i].elm)
{
if
(!this.doc.recycled) this.doc.recycled=[];
this.doc.recycled[this.doc.recycled.length]=this.children[i].elm;
}
DynLayer.deleteElement(this.children[i]);
this.children[i].parent=null;
this.children[i].isChild=false;
this.children[i].destroy(); //<------- da call
-----------------------------------------------------//
}
this.children=[];
};
the destroy function is as follows:
DynLayer.prototype.destroy=function(){
status="Destroy called
"+(++calledtimes)+" times";
//delete all properties and function of
the DynLayer
object
this.removeAllEventListeners();
delete
this.id;
delete this.x;
delete this.y;
delete
this.w;
delete this.h;
delete this.bgColor;
delete
this.visible;
delete this.z;
delete
this.bgImage;
delete this.children;
delete
this.parent;
delete this.isChild;
delete
this.created;
delete this.html;
delete
this.bgImage;
delete this.elm;
delete
this.doc;
delete this.css;
delete
this.unassigned;
delete this.nullCount;
delete
this.createElement;
delete this.deleteElement ;
delete
this.assignElement;
delete this.assignChildren;
delete
this.flagPrecreate;
delete this.flagDeleteChildren;
delete
this.isDynLayer ;
delete this.getClass;
delete
this.toString;
delete this.addChildID;
delete
this.addChild;
delete this.removeChild;
delete
this.removeFromParent;
delete this.deleteChild;
delete
this.deleteAllChildren;
delete this.deleteFromParent;
delete
this.getInnerHTML;
delete this.getOuterHTML;
delete
this.setStyle;
delete this.moveTo;
delete
this.moveBy;
delete this.setX;
delete
this.setY;
delete this.getX;
delete
this.getY;
delete this.getPageX;
delete
this.getPageY;
delete this.setPageX;
delete
this.setPageY;
delete this.setVisible;
delete
this.getVisible;
delete this.setZIndex;
delete
this.getZIndex;
delete this.setBgImage;
delete
this.getBgImage;
delete this.setBgColor;
delete
this.getBgColor;
delete this.setHTML;
delete
this.getHTML;
delete this.setSize ;
delete
this.setWidth;
delete this.setHeight;
delete
this.getWidth;
delete this.getHeight;
delete
this.getContentWidth;
delete this.getContentHeight;
delete
this.setClip;
delete this.getClip;
delete
this.invokeEvent;
// delete this.destroy;
};
Results of testing:
IE5.5
Win98 (NOT SE)
-with destroy
before loading
site :4,392
after loading site :7,960
after unloading
site:8,448
-without destroy
before loading
site :4,420
after loading site :7,900
after unloading
site:7,780
As you can see, the amount of ram INCREASED after
calling deleteAllChildren with the destroy function
Still pluggin at it,
Doug Melvin
P.S.
I have devoted the afternoon to this
problem..
So any feedback/suggestions/comments should be
sent ASAP
Thank y'all