Hi,
In my Remoting project there exists a service, which returns an image
stream per client call (each second).
Everything seems to operate well, except that it produces a mem-leak
on the Server side: TaskManager MemUsage counts up constantly.
Code snippets:
--------------
@Client:
mystream=remoteObject(SendImageStream(filename));
....
@Server/R_Object:
public object SendImageStream(string Filename)
{
FileStream fs=new(Filename,FileMode.Open,..etc....);
int length=(int)fs.Length;
byte[] buffer=new byte[length];
fs.Read(buffer,0,length);
fs.Close();
return new MemoryStream(buffer,0,length,false,false);
}
----------------
Debugging reveals that out of those 3 'new' occurences, the 'new
byte....' is causing the troubles.
It looks like logical, cause the Client needs the buffer data, so the
GC doesnot collect this item (even if I forced it through GC.Collect,
it'll still produce the leak).
Please advise on how to solve this situation.
Thanks ahead!
victor.