Hi, You do realize that that code creates 1,000 *overlapping* requests to your server, right? :-) Ajax.Request is asynchronous by default.
Another thing to remember is that JavaScript is a garbage-collected language; GC doesn't necessarily happen right away, when and how is implementation-dependent. And finally: If your goal is to release the string referenced via transport.responseText, rather than relying on abort() to do it (which it may or may not), you could always, you know, do it: t.responseText = undefined. Of course, if nothing is referencing the request for any length of time (and nothing in your first quoted code is, AFAICS), all of the constituent parts are eligible for GC right away anyway... FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Feb 23, 10:47 am, outersky <[email protected]> wrote: > Hi, all, > I just run the following code for 1000 times, and Firefox used 600M > memory. > > for(var i=0; i<1000; i++){ > new Ajax.Request('download.jsp?r='+Math.random(), { > method:'post', > parameters: "length=102400" > }); > > } > > here download.jsp will return a simple json struct like this: > > { 'content': 'AAAAAAAAAAA...'} > > where content is a string of length 102400. > > when I turn on firebug, I find every transport has a responseText > property , which contains the large string object, > then I think I should clean the responseText, so I change it to this: > > new Ajax.Request('download.jsp?r='+Math.random(), { > method:'post', > parameters: "length=102400", > onSuccess: function(t){ t.transport.abort > (); } > }); > > In firebug, I found transport.responseText is cleared. but firefox > still uses 600M memory . > > why ? and how to fix it? > > Thank you very much ! > > Outersky > 2009-02-23 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
