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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to