Memory leak in IE javascript with webservice.htc

C

Chris Bardon

I'm working on an application where I need to be able to call a .net
web service from javascript. I found the webservice.htc file, and was
able to create a page that worked just fine, except that the memory
usage of iexplore.exe began to increase without limit as the service
was called. To demonstrate this, I tried the following script, which
showed the increase very quickly by continuously calling the service.
Since useService is the only method being called, this is likely where
the problem lies. Is there a fix for this problem yet?

Thanks,

Chris


<html>
<head>
<script language="JavaScript">

function init()
{
service.useService("http://testServer/testcti/service1.asmx?WSDL","Test");
call();
}

function call()
{
service.TestCTI.callService("AgentEventWait",1000,100,"ice1");
}

function onWSresult()
{
call();
}
</script>
</head>
<body onload="init()">
<div id="service" style="behavior:url(webservice.htc)"
onresult="onWSresult()">
</div>
</body>
</html>
 
B

bruce barker

IE has lots of memory leaks, not surprising that that there is a leak
calling xmlhttp. I doubt that any fix will be coming, as the soap behavior
calls for increased security settings with xp-sp2. switch to the standard
hidden frame approach for IE, and save soap calls for mozilla/netscape which
have it in.

-- bruce (sqlwork.com)
 
G

Gabe Garza

Chris,

You've setup call() to call itself until run IE runs out of memory.
'onresult' is for checking the result of a callService().
In your 'onWSresult()' Javascript function don't call call(), check for the
following

function onWSresult()
{
if((event.result.error)&&(iCallID==event.result.id))
{
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;

// Add code to output error information here
alert("Error ");
}
}

The way you have it now

function onWSresult()
{
call();
}

onWSresult() calls call() over and over again because you've setup a
onresult to fire an event after AgentEventWait is finished.

Once the first call() is finished, which is your call to your
AgentEventWait, that's when your onresult event gets fired, which is your
onWSresult() function.
onWSresult() calls call() again, once that call is finished, again your
AgentEventWait, then that's when your onresult event gets fired again, which
is your onWSresult().

To verify that this is the case, use DbgCLR.exe and set a breakpoint inside
of AgentEventWait, then call your HTML page that calls the webservice.
You'll see AgentEventWait being called again and again.

Gabe
 
C

Chris Bardon

Thanks Bruce-is there somewhere that details this "hidden frame"
approach that you're talking about? I tried a version where I had a
frame invoking the web service using an HTTP GET call and the page's
location property, but there was no way that I could get the returned
XML to the main frame without an access violaton. Since the web
service call that I'm making can block, I can't really use the auto
refresh property to perpetually call it. Ideally, I'd like to be able
to do what I had in my script, which is to call the service, handle
the return, then call it again. Any idea how I can accomplish this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top