HttpWebResponse Memory Size Problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randy Chow

    #1

    HttpWebResponse Memory Size Problems

    Hello everyone I was wondering if anyone has come across my problem? I
    programmed a Windows Service that uses httpWebRequest and httpWebResponse in
    VB.NET. Everything works fine until I use the webresponse object. What the
    Windows Service does is when the timer in the windows service elapses, the
    request to the website is made and a response is retrieve in a simple
    myhttpWebreques t.GetResponse() . I don't even do anything with the response,
    and close out of the response immediately. But the Windows Service then
    creates a connection for each call for the website and causes the memory to
    increase to 30 MB. When I use a netstat on the server, I see multiple http
    connections due to this Windows Service. I tried to set the timeout on the
    myhttpWebReques t but it does nothing. Another person replied saying to use
    the dispose method of the WebResponse, but that has been taken out of the
    latest version. Is there a way to make the application to disconnect after
    the connection and call to the website has been made? The code is
    extrememly simple, create the webrequest, create a webresponse, close the
    webresponse, and set the webrequest and webresponse to nothing in the timer
    elapsed event. The event is called every 2 seconds, and runs well except it
    continues to grow. Sometimes it will shrink slightly but still grow. I
    updated the .NET to version 1.1 SP 1. I then added GC.Collect, but if I
    recall correctly, GC.Collect does not release the memory back to the server,
    and only releases it back to the program. Thanks.


Working...