[Mono-devel-list] Web Socket Code

Colt Majkrzak majkrzak at gmail.com
Thu Jul 29 21:10:02 EDT 2004


This email was originally sent about a month back, but every email
account I have keeps getting the "Mail header looks suspicious" from
the list server, but my gmail account seems to work with the list
perfectly.

 

 

 

 

Hello everyone, I'm having a problem with my code under mono.  It
appears to work perfectly using MS .NET framework 1.1 but under mono
it tends to eat 8k of memory every time the function is ran.

 

 

class MyClass {

      private System.Net.WebClient Client;

      private Stream strm;

      private StreamReader sr;

      private string result;

 

      public void estvars()

      {

            Client = new WebClient();

      }

      

      public string openurl(string url)

      {

            result = System.String.Empty;

            

            strm = Client.OpenRead(url);

            sr = new StreamReader(strm);

            

            result = sr.ReadToEnd();

            

            sr.Close();

            

            strm.Close();

            

            

            result = result.Trim();

            

            return result;

      }

}

 

The program starts by executing estvars() which sets up the webclient
along with many other vars im using.  I've determined it is this
function doing the mem leak problem after a few days of separating
code up and testing each part separately.  Function openurl is ran in
an endless loop for the most part with 5 second delays between cycles,
and I've noticed that under mono the memory usage goes up about 8k and
handles increase about 6 per 5 second cycle.  It appears to do this
with Mono 1.0 Win32 or RH9 Linux, but does not with Win32 MS.NET 1.1
framework.  I'm not sure if I'm missing something very obvious here or
what, but with this eating up 8k per 5 seconds im having to restart it
on my linux boxes about every day before it chews up to much memory.

 

Thanks everyone in advance.



More information about the Mono-devel-list mailing list