Memory leak in IE javascript with webservice.htc

Discussion in 'ASP .Net Web Services' started by Chris Bardon, Sep 27, 2004.

  1. Chris Bardon

    Chris Bardon Guest

    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>
    Chris Bardon, Sep 27, 2004
    #1
    1. Advertising

  2. Chris Bardon

    bruce barker Guest

    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)


    "Chris Bardon" <> wrote in message
    news:...
    > 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>
    bruce barker, Sep 27, 2004
    #2
    1. Advertising

  3. Chris Bardon

    Gabe Garza Guest

    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


    "Chris Bardon" <> wrote in message
    news:...
    > 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>
    Gabe Garza, Sep 27, 2004
    #3
  4. Chris Bardon

    Gabe Garza Guest

    Opps, meant to say until the OS runs out of memory.

    "Gabe Garza" <> wrote in message
    news:4k%5d.20491$...
    > 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
    >
    >
    > "Chris Bardon" <> wrote in message
    > news:...
    > > 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>

    >
    >
    Gabe Garza, Sep 27, 2004
    #4
  5. Chris Bardon

    Chris Bardon Guest

    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?

    "bruce barker" <> wrote in message news:<>...
    > 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)
    Chris Bardon, Sep 28, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Bardon
    Replies:
    4
    Views:
    3,265
    Chris Bardon
    Sep 28, 2004
  2. batista
    Replies:
    1
    Views:
    911
    Laurent Bugnion
    Jan 26, 2006
  3. batista
    Replies:
    0
    Views:
    561
    batista
    Jan 26, 2006
  4. batista
    Replies:
    0
    Views:
    98
    batista
    Mar 8, 2006
  5. batista
    Replies:
    1
    Views:
    105
    Jonas Raoni
    Mar 12, 2006
Loading...

Share This Page