[Javascript] AJAX app causing excessive browser memory usage

Matt Warden mwarden at gmail.com
Thu May 18 20:49:39 CDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rick Emery wrote:
>>> xmlList = null;
>>
>> Keep this one.
> 
> Why wouldn't this, like the others, happen when it fell out of scope 
> (i.e., when the handleELResponse() function exited)?

In your example it looked like this was in global scope.

>> Well you're creating a new XHR object every 30 seconds. Not a problem if
>> you're handling its destruction properly, but I have a hunch you are not.
> 
> 
> I'm actually not creating a new one every 30 seconds; I create the xhr 
> object when the page first loads, and reuse it every 30 seconds to  send
> the request (and process the response).

I would suggest not doing this. The object is meant to represent a
request, not a connection. At minimum, the object and all its request
and response content must remain in memory indefinitely rather than only
for x milliseconds while you do your processing. At worst, the designers
of the object assumed a short lifecycle and coded accordingly.


- --
Matt Warden
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEbSQzrI3LObhzHRMRAh7GAKCnI2wDO2OYss7yTWdyd7ld3c35PACfWLbm
0mow5Ay7iuKa8T6ts07At1o=
=MGgs
-----END PGP SIGNATURE-----



More information about the Javascript mailing list