Currently I'm doing some experimenting with the XMLHTTP object in
Javascript. Now,
the XMLHttp object is asynchronous (at least in this case), and the
following code causes a significant memory loss even though I seem to be
allocaitng everything; help would be *vastly* appreciated. What am I doing
wrong here? I thought I was doing everything correctly (setting things to
null, for example) but none of the memory seems to get replaced. I've been
experiencing allocations of memory up to 125 megabytes (!) that simply
persist in the browser, never to go away...
Thanks in advance for any help you can provide!
ASyncQueue = new Array();
-Justice
function DataHandlerLook upLoop(value, id, numberOfLoops)
{
for (var loopCount = 0; loopCount < numberOfLoops; loopCount++)
{
DataHandlerLook up(loopCount,lo opCount,id);
}
}
function DataHandlerLook up(value, number, id)
{
++asyncsRunning ;
AsyncQueue.push (new Object());
AsyncQueue[number].ThisElement = document.getEle mentById(id);
AsyncQueue[number].Server = new ActiveXObject(" Msxml2.XMLHTTP" );
AsyncQueue[number].Server.onready statechange = f;
AsyncQueue[number].Server.open("G ET",
"http://localhost/MyCompany/data.metadata?t ext=" + value, true);
AsyncQueue[number].Server.send(va lue);
}
function f()
{
var temporaryLength = AsyncQueue.leng th;
for (var index = 0; index < AsyncQueue.leng th; ++index)
{
if (AsyncQueue[index] != null)
{
if (AsyncQueue[index].Server.readySt ate == FINISHED)
{
AsyncQueue[index].Server.abort() ;
AsyncQueue[index].Server = null;
delete AsyncQueue[index].Server;
AsyncQueue[index].ThisElement = null;
delete AsyncQueue[index].ThisElement;
AsyncQueue[index] = null;
--asyncsRunning;
}
if (asyncsRunning == 0)
{
var tempQueueLength = AsyncQueue.leng th;
for (var ix = 0; ix < tempQueueLength ; ++ix)
{
AsyncQueue.pop( );
}
CollectGarbage( );
}
}
Javascript. Now,
the XMLHttp object is asynchronous (at least in this case), and the
following code causes a significant memory loss even though I seem to be
allocaitng everything; help would be *vastly* appreciated. What am I doing
wrong here? I thought I was doing everything correctly (setting things to
null, for example) but none of the memory seems to get replaced. I've been
experiencing allocations of memory up to 125 megabytes (!) that simply
persist in the browser, never to go away...
Thanks in advance for any help you can provide!
ASyncQueue = new Array();
-Justice
function DataHandlerLook upLoop(value, id, numberOfLoops)
{
for (var loopCount = 0; loopCount < numberOfLoops; loopCount++)
{
DataHandlerLook up(loopCount,lo opCount,id);
}
}
function DataHandlerLook up(value, number, id)
{
++asyncsRunning ;
AsyncQueue.push (new Object());
AsyncQueue[number].ThisElement = document.getEle mentById(id);
AsyncQueue[number].Server = new ActiveXObject(" Msxml2.XMLHTTP" );
AsyncQueue[number].Server.onready statechange = f;
AsyncQueue[number].Server.open("G ET",
"http://localhost/MyCompany/data.metadata?t ext=" + value, true);
AsyncQueue[number].Server.send(va lue);
}
function f()
{
var temporaryLength = AsyncQueue.leng th;
for (var index = 0; index < AsyncQueue.leng th; ++index)
{
if (AsyncQueue[index] != null)
{
if (AsyncQueue[index].Server.readySt ate == FINISHED)
{
AsyncQueue[index].Server.abort() ;
AsyncQueue[index].Server = null;
delete AsyncQueue[index].Server;
AsyncQueue[index].ThisElement = null;
delete AsyncQueue[index].ThisElement;
AsyncQueue[index] = null;
--asyncsRunning;
}
if (asyncsRunning == 0)
{
var tempQueueLength = AsyncQueue.leng th;
for (var ix = 0; ix < tempQueueLength ; ++ix)
{
AsyncQueue.pop( );
}
CollectGarbage( );
}
}
Comment