views:

45

answers:

1

Hiya,

Hoping you could help me please..

I am using WCF in my program. Part of this includes using ServiceHost in a self-service type scenario using a netNamedTypeBinding. When I include ServiceHost in my class and then instantiate that class (ServiceHost is set to null at this point), the memory usage increases by approx 9Mb. If I comment out the ServiceHost attribute the memory doesnt jump.

This is a fair old chunk of memory being used by ServiceHost. Is there anyway to cut this down or is there a version of ServiceHost that is leaner? Asking out of desperation really as I need to my my program as memory efficient as possible.

Many thanks for your time

A: 

Direct answer: No probably not. You are pulling in a sizable library and you'll just have to pay the price.

But a couple of points:

  • on any platform that can run WCF at all, 9MB shouldn't be a lot.
  • measuring memory use under a modern OS is complicated. What memory value (there are many) are you using for this?
Henk Holterman
Hi Henk, Thanks for your answer! I was measuring this using SysInternals ProcExplorer and using the PrivateBytes field for the process in question. I Attached a Debugger to the process and stepped through whilst keeping an eye on ProcExplorer. Crude I know but it did allow me to comment out various items and see the effect on mem used. You are right though, 9Mb seems acceptable to me but not to the powers that be :( Shame really as WCF handles all the callbacks etc that I needed. Thanks again for your answer!
FrankieRed