I'm not sure whether this is still relevant to the current version of MochiKit (I'm not using MK at all, just groping with similar issues), but I just noticed that IE 6 gives a 'type mismatch' when I try to assign null to onreadystatechange. That is probably b/c XMLHTTPRequest is an ActiveX object, not a JS one. IE 7 does not do that, apparently b/c XMLHTTPRequest has now become a native JS object. In IE6, assigning function (){} works. I have not determined whether this will fix any memory issues. I found the mismatch using a tool called Web Developer Helper - link: http://www.nikhilk.net/Project.WebDevHelper.aspx
On Mar 13, 6:41 pm, "Bob Ippolito" <[EMAIL PROTECTED]> wrote: > On 3/13/07, Devon Miller <[EMAIL PROTECTED]> wrote: > > > > > I've found what looks like a memory leak in Async.SendXMLHttpRequest. Here's > > the trail I'm following: > > > req (1st param to SendXMLHttyRequest) is an instance of whatever object is > > supplying XMLHttpRequest functionality > > > d (local var to SendXMLHttyRequest) is set to > > Base.partial(Async._xhr_canceller, req) > > > So we have > > req > > > and > > d = anonfunc1 > > .im_func = Async._xhr_canceller > > anonfunc1.im_preargs [0] = req; > > > Finally, req.onreadystatechange is set to > > Base.bind(Async._xhr_onreadystatechange, req, d) giving us: > > > req.onreadystatechange = anonfunc > > req.onreadystatechange.im_func = Async._xhr_onreadystatechange > > req.onreadystatechange.im_preargs[0] = d > > req.onreadystatechange.im_self = req > > > The last value is where I believe the leak occurs, because that results in > > this loop: > > req.onreadystatechange.im_preargs > > [0].anonfunc.im_preargs[0] = req > > > When Async._xhr_canceller or Async._xhr_onreadystatechange are called, they > > set req.onreadystatechange to null. Leaving this: > > anonfunc > > However, I cannot find anywhere that this loop is broken if the request > > succeeds. The leak detector extension ( > >http://dbaron.org/mozilla/leak-monitor/) seems to back this > > up as I get 1 reported leak for every XMLHttpRequest I make. > > I don't know what version of MochiKit you're looking at, but I can't > reproduce this leak with svn trunk and it definitely does set > this.onreadystatechange = null on success. > > -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---