Re: possible bug in XMLHttpRequest

jose antonio <[email protected]> Fri, 25 Oct 2002 10:33:16 +0200
Newsgroups gmane.comp.mozilla.devel.xpfe,gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Erik Arvidsson wrote:

> The memory will only be freed once the garbage collector kicks in.
>
> erik
>
> "jose antonio"  wrote in message
> news:[email protected]...
>
> >Hello,
> >I am trying to get remote XML with XMLHttpRequest. my source code is:
> >
> >function load() {
> >   var req = new XMLHttpRequest();
> >   req.open("GET","http://www.foo.com/anxml.xml",false);
> >   req.setRequestHeader('content-type','text/xml');
> >   req.onload = function() {
> >     alert("received");
> >   }
> >   req.send(null);
> >
> >}
> >
> >it works, but When I execute the function load more than once, the
> >memory used by mozilla grows exactly the size of the document I am
> >requesting. For example:
> >
> >first time: 22.4 mb;
> >second time: 23.4 mb;
> >third time: 24.4 mb;
> >
> >when the file size is 1mb;
> >
> >But, if I initialize the req object like a global variable, the memory
> >is always the same.
> >
> >I don't understand why the memory is being increased. The object would
> >be destroyed every time the function load finishes. Or it would not?
> >
> >Is it a bug? Is it correct?
> >
> >Thanks.
> >
>
>
>
ok, How can I decide to kick in the memory? Is there any Component to 
access it?

I think it could be interesting. I need to free the memory after each 
request.

In addition, my function have the request object like a local var. When 
the function has finished the memory might be freed.