On Dec 22 2006, 3:48 pm, "Bob Ippolito" <[EMAIL PROTECTED]> wrote:
> On 12/23/06, David Mertz <[EMAIL PROTECTED]> wrote:
> > To round out the info, I am using MochiKit 1.3.1.  And actually, the
> > same issue seems to affect IE, Firefox 1.5.1, and Safari.  We did try
> > MochiKit 1.4 also, but it seemed at quick glance to have a similar
> > problem (becoming unresponsive after a while, though I haven't
> > specifically watched memory usage).
>
> > Here's a minimal version of the problem code (very minimal):
>
> > function set_message(message) {
> >     var div = getElement("message");
> >     replaceChildNodes(div, message);
> > }
> > function process_data(feed_data) {
> >     set_message(null);
> >     callLater(10, request_updates);
> >     return;
> > }
> > function request_updates() {
> >     set_message("Loading...");
> >     var data = loadJSONDoc("get_rss.cgi");
> >     data.addCallbacks(process_data, connection_error);
> > }
> > connect(window, 'onload', request_updates);
>
> > Obviously, the real version of process_data() does some more
> > interesting stuff with the 'feed_data' (create some TRs and then
> > replaceChildNodes() using them).  But even this minimal version shows
> > the memoryleak.  I watch the memory in Gnome System Monitor (but some
> > other tool would be the same), and it increases by about 0.5 megs each
> > reload... the loaded data is identical on each load (for the test
> > system), and happens to be 150,446 bytes.  It's not hard to believe
> > that the string converted to a data structure might eat a little more
> > memory though (assuming that is theleak).
>
> I don't see anything obvious here, could you provide a full example
> with HTML and all so that it can be easily reproduced?
>
> -bob

I'm seeing this behavior too. I'm running FF1.5.0.9 with this
extension:
http://dbaron.org/mozilla/leak-monitor/
When I close or reload the page it is giving me the following report
for every loadJSONDoc call I made

Leaks in window 0x5e19ed0:
[+] [leaked object] (5c692c0, http://cac1/~devon/MochiKit/Base.js,
489-499) = [Function]
 [+] im_self (5b72ea8) = [XMLHttpRequest]
  [ ] send (5e4bed0) = [Function]
 [+] im_func (60dfaf8, http://cac1/~devon/MochiKit/Async.js, 281-314)
= [Function]
  [ ] NAME = MochiKit.Async._xhr_onreadystatechange
  [ ] prototype (2a01300) = [Object]
 [+] im_preargs (5c69240) = [Array]
  [+] 0 (5c69088) = [Object]
   [ ] chain (5c690c0) = [Array]
   [ ] id = 1
   [ ] fired = 0
   [ ] paused = 0
   [-] results (5c69180) = [Array]
   [-] canceller (5c69038, http://cac1/~devon/MochiKit/Base.js,
489-499) = [Function]
   [ ] silentlyCancelled = false
   [ ] chained = false
 [ ] prototype (2a012e0) = [Object]

Here is a simplified test case that reproduces this problem:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html><head><title>Testing MochiKit</title>
<script type="text/javascript" src="MochiKit/MochiKit.js"></script>
<script type="text/javascript">
    function processData(data) {
        var el = document.getElementById('json');
        if (el)
            el.appendChild(document.createTextNode(new Date()));
    }
    function update() {
        var args = {arg1 : $( 'arg1' ).value};
        MochiKit.Async.loadJSONDoc("json_data",
args).addCallback(processData);
    }
  </script>
</head><body><form><div>
Arg1 <input type="text" id="arg1"><br>
<textarea id="json"></textarea><br>
<button onclick="update();return false">Update</button>
</div></form></body></html>

And for the moment, the json_data is simply this text file:
{ str: "This is some JSON data" }

dcm


--~--~---------~--~----~------------~-------~--~----~
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