[Mono-devel-list] Web Socket Code

Tron Chambers monoguy at speakeasy.net
Thu Jul 29 23:07:19 EDT 2004


I have been seeing this exact issue as well.

I have very similar code that actually uses lower level libraries than 
WebClient, as it reads from the socket directly.  After about 12 hours 
or so of reading and writing to sockets in a constant loop it dies with 
a some sort of GC out of memory error (it's not neccesarily the same 
one, but it is usually the RETURNING NIL one in the boehm library) and 
it appears to be an infinite loop. (processor usage at 100% etc). 

I have spent a great deal of time trying to understand this bug, but 
have yet to nail down a smoking gun.  I would guess it is a leak in 
freeing resources from the native socket code... And just to be clear, I 
am not failing a sanity check by keeping around strong references to 
anything; it is definetly a mono-specific problem.

I am very happy to see someone else with the same issue and a minimal 
code sample.  Help on debugging this would be greatly appreciated, 
having to restart my program every ~10 hours is getting frustrating.

Thanks to miguel and the team for the great work so far :)

-t.c.

Colt Majkrzak wrote:

>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.
>_______________________________________________
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>  
>




More information about the Mono-devel-list mailing list