问题
I have a WCF service hosting in IIS using net.tcp binding and configured for PerCall instancing. For test purposes, I have a single operation that does absolutely nothing.
Every time a client connects and calls the operation, memory usage increases for the w3wp.exe process and after the client has closes the connection, the memory usage does not decrease. After repeated calls, the memory has increased from an initial 20MB to 500MB or more.
Is this normal behavior?
回答1:
When you call a service with PerCall Instance Context mode then the memory should be released after the method returns. Since that is not happening in your scenario, try to implement the IDisposable interface on your services to be able to control the disposal of your services explicitly. Also make sure that you close your proxy connections on the client right after usage.
来源:https://stackoverflow.com/questions/4680289/wcf-memory-usage