Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF memory usage

Tags:

memory

wcf

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?

like image 911
Bethany Carter Avatar asked Dec 07 '25 23:12

Bethany Carter


1 Answers

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.

like image 104
Faris Zacina Avatar answered Dec 09 '25 18:12

Faris Zacina