Bugs item #787137, was opened at 2003-08-12 13:36 Message generated for change (Comment added) made by agillett You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105757&aid=787137&group_id=5757
Category: DynAPI 3 API Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrew Gillett (agillett) Assigned to: Nobody/Anonymous (nobody) Summary: Memory leak in DynElement.deleteChild() Initial Comment: The DynElement.deleteChild() function is implemented thus: p.deleteChild = function(c) { c.removeFromParent(); c._delete(); }; Although the _delete() function is documented in quickref.dynelement.html, it is not implemented _anywhere_ in the DynAPI source code, except for being set to dynapi.functions.Null in event.js. If you have a page that repeatedly adds and removes DynElements, it will leak memory. If you replace the call to _delete() with a call to _destroy(), the memory leak goes away: p.deleteChild = function(c) { c.removeFromParent(); c._destroy(); }; ---------------------------------------------------------------------- >Comment By: Andrew Gillett (agillett) Date: 2003-08-14 10:31 Message: Logged In: YES user_id=134108 > Are you using the lastest snapshot? Yes, I check out the code directly from CVS. > What browsers are experiencing this memory leak? IE6 & Mozilla1.4, but that is not really relevant. On 29/07/2003 12:26 AM (my time), in response to my post about a bug in deleteAllChildren(), you wrote: >To fix the memory and layer problem use the following: > >p.deleteAllChildren = function() { > var c,l = this.children.length; > for(var i=0;i<l;i++) { > c=this.children[i]; > if(c) { > c._destroy(); > c._created = c.isChild = false; > }; > delete this.children[i]; > } > this.children.length = 0; >}; > This fix worked perfectly. The _destroy() method is called on each child of the layer. However this is not what was put into CVS. In the current version of event.js, deleteAllChildren() calls deleteFromParent () which calls deleteChild() which calls _delete() instead of _destroy(). It is the call to _delete() that I have a problem with. There is simply no such function. In line 184 of event.js there is: ... = p._delete = p._destroy = dynapi.functions.Null; but nowhere else in the entire source tree is _delete() defined. Try the attached example. On my Windows XP system, IE grows by about 6MB each time the "Memory Leak" button is pressed. But if I replace the call to _delete() with a call to _destroy() in the deleteChild function, then IE doesn't leak at all. ---------------------------------------------------------------------- Comment By: Raymond Irving (xwisdom) Date: 2003-08-13 23:53 Message: Logged In: YES user_id=696242 Are you using the lastest snapshot? What browsers are experiencing this memory leak? You can get the lastest snapshot here: http://dynapi.sourceforge.net/snapshot/?N=D ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105757&aid=787137&group_id=5757 ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/[EMAIL PROTECTED]/