Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > What's wrong with my Javascript? Memory Leak/Circular Reference

Reply
Thread Tools

What's wrong with my Javascript? Memory Leak/Circular Reference

 
 
kstahl@doboy.com
Guest
Posts: n/a
 
      12-17-2005
I'm trying to use the XmlHttpRequest object from a windows CE device
under IE. When I do I get some serious memory leaks. It doesn't seem
to happen running the same code on Desktop IE. Any of you Javascript
experts care to offer an opinion?

This seems to have been an issue a few years ago on Desktop browswers
but it has either been fixed or a workaround was dicovered. Do the
AJAX libraries have a solution?

I've created a simple test to isolate the problem. I have two simple
html
files on the CE Device (the web server)

Xml.htm contains the following:
<html>
<head>
</head>
<body onload="updateXml(0);">
<form name="form1">
Counter and Response:
<textarea name="xmlResponse" cols=80
rows=10></textarea>
xmlHttpRequest Ready State:
<input name="readystate">
Update Interval (milliseconds):
<input name="interval" value="1000">
</form>
<script language="JavaScript">
var xmlObj=null;
var count = 0;

function updateXml(input)
{
var url;
url = "RealtimeXml.htm?Param=" + input;

xmlObj = new
ActiveXObject("Microsoft.XMLHTTP");
xmlObj.onreadystatechange =
processReqChange;
xmlObj.open("GET", url, true);
xmlObj.send(null);
}
function processReqChange()
{
document.form1.readystate.value =
xmlObj.readyState;
if(xmlObj.readyState == 4)
{

document.form1.xmlResponse.value = count + "\n" +
xmlObj.responseText;
count++;
setTimeout("updateXml(" + count
+ ")",
document.form1.interval.value);
}
}
</script>
</body>
</html>

The second file is called RealtimeXml.htm and contains a single
character '1'.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong with using return const reference Subhransu C++ 1 01-12-2009 02:50 PM
What is wrong with reference into std::map? Jim Langston C++ 10 05-15-2006 03:02 PM
wrong dll being used from project reference? =?Utf-8?B?aG93YXJkIGRpZXJraW5n?= ASP .Net 2 11-05-2005 02:57 AM
Is XML Doc wrong or is Schema wrong? (or both) Matthew XML 7 01-07-2005 10:05 PM
Differences between Sony Memory Stick & memory Stick Pro vs Memory Stick Duo? zxcvar Digital Photography 3 11-28-2004 10:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57