How can I prevent BufferManager / PooledBufferManager in my WCF client app from wasting memory?

后端 未结 3 2325
Happy的楠姐
Happy的楠姐 2020-12-01 18:47

Analyzing a WCF client application (that I did not write and still do not know too much about) that talks to a bunch of services via SOAP and after running for a couple of d

3条回答
  •  执笔经年
    2020-12-01 19:24

    4) Are we doing something wrong here? I'm not a WCF expert by any means, so could we make the various HttpsChannelFactory instances all use the same BufferManager?

    5) Or maybe even better, could we just tell all HttpsChannelFactory instances NOT to use BufferManagers at all and ask the GC to do its god-damn job, which is 'managing memory'?

    I guess one way of addressing those 2 questions could be changing the TransferMode from 'buffered' to 'streamed'. Will have to investigate, as 'streamed' mode has a couple of limitations and I might not be able to use it.

    Update: It actually works great! My memory consumption in buffered mode during startup of the app was 630M at peak times, and reduced to 470M when fully loaded. After switching to streamed mode, memory consumption does not show a temporary peak and when fully loaded, consumption is at only 270M!

    Btw., this was a one-line change in the client app code for me. I just had to add this line:

    httpsTransportBindingElement.TransferMode = TransferMode.StreamedResponse;
    

提交回复
热议问题