Dear Devs
I have a very small wcf service hosted in a console app.
[ServiceContract]
public interface IService1
{
[OperationContract]
void DoService();
}
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]
public class Service1 : IService1
{
public void DoService()
{
}
}
and its being called as
using (ServiceReference1.Service1Client client = new ServiceReference1.Service1Client())
{
client.DoService(new DoServiceRequest());
client.Close();
}
Please remember that service is published on basicHttpBindings.
Problem
Now when i performed above client code in a loop of 1000 i found big difference between "All Heap bytes" and "Private Bytes" performance counters (i used .net memory profiler). After investigation i found some of the objects are not properly disposed following are the list of those objects (1000 undisposed instance were found --> equals to the client calls)
(namespace for all of them is System.ServiceModel.Channels)
HttpOutput.ListenerResponseHttpOutput.ListenerResponseOutputStream
BodyWriterMessage
BufferedMessage
HttpRequestContext.ListenerHttpContext.ListenerContextHttpInput.ListenerContextInputStream
HttpRequestContext.ListenerHttpContext
Questions Why do we have lot of undisposed objects and how to control them.
Please Help