From: Raymond I. <xw...@ya...> - 2003-07-28 15:53:04
|
Hi Jeremy, This should fix the error. Make the change to the dynlayer_base.js file. p._destroyAllChildren = function() { for (var i=0;i<this.children.length;i++) { this.children[i]._destroy(); delete this.children[i]; } this.children.length=0; }; It's very strange I don't see a memory leak with the following examples: dynapi.api.dynlayer-destroy.html speedtest.dynlayer-deep_nest.html It seems that the ModWindow object is not doing something right. I don't understand why. Does anyone have any idea or solution? -- Raymond Irving --- Jeremy Wanamaker <je...@ma...> wrote: > I've attached a sample of my code which causes the > error for me in IE 6. In > my code, I have called 2 instances of my ModWindow > widget. If I only call > one instance, I don't get the error, but with two it > shows up. I believe it > may have to do with _destroy being called when the > 'unload' event fires. > Could it be that the _destroy function is unable to > finish before the page > is unloaded, thereby causing some object references > to be lost? This would > explain the memory leak. > > Jeremy Wanamaker > > ----- Original Message ----- > From: "Raymond Irving" <xw...@ya...> > To: <dyn...@li...> > Cc: <je...@ma...> > Sent: Friday, July 25, 2003 6:18 PM > Subject: Re: [Dynapi-Dev] memory leak > > > > > > Could you please supply an example showing this > error? > > > > I think this has something to do with the > ._destroy() > > function > > > > -- > > Raymond Irving > > > > > > --- Jeremy Wanamaker <je...@ma...> > wrote: > > > I been working with DynAPI 3 for a couple of > weeks > > > now. Overall, I'm very > > > impressed and optimistic about the future of > DynAPI. > > > > > > I'm having trouble with (what I believe is) a > memory > > > leak in dynapi.js at > > > line 106: > > > > > > f.onunload = function() { > > > //alert('hi'); > > > for (var > > > i=0;i<o._unloadfn.length;i++) o._unloadfn[i](); > > > if (o.document) { > > > o.document._destroy(); > > > o.document = null; > > > } > > > }; > > > > > > I'm working on a window widget with quite a few > > > DynLayers and when unload > > > event triggers, the document unloads before the > > > above function is finished > > > and I get the following error in IE6: > > > > > > Error:'this.children[...]' is null or not an > > > object > > > > > > ...at which point I notice that my available > system > > > memory has been reduced > > > by a couple hundred KBytes or so. I get the same > > > error in Netscape 7.1, but > > > I can get around it by changing the event > listener > > > from 'onunload' to > > > 'onbeforeunload'. Alas, this does not fix the > > > problem in IE. Has anyone else > > > run into this problem? Are there any known > > > workarounds? Thanks in advance > > > for you help and keep up the good work. > > > > > > Jeremy Wanamaker > > > > > > > > > > > > > > > ------------------------------------------------------- > > > 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 > > > Dyn...@li... > > > > > > http://www.mail-archive.com/dyn...@li.../ > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free, easy-to-use web site > design software > > http://sitebuilder.yahoo.com > > > > ATTACHMENT part 2 application/x-zip-compressed name=mem_leak.zip __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |