We are having a memory leak problem between our MVC3 web application and our WCF data-level service.
I believe that the problem is related to WCF, although it cannot track it. I searched the Internet and these forums, but could not find the reason. Any help would be greatly appreciated!
So, the initial symptom was the size of the w3wp process, associated with an ever-growing backend. We can see that it grows by a variable value (of the order of 100 kb) every time a simple call is made from a web application that calls a service.
Running a Jetbrains memory profile in an application, you can see that
System.ServiceModel.Channels.TransmissionStrategy.SlidingWindow
far and far offender. When the application starts, there are 4 objects created with a small amount of memory (6.4% of the total), after moderate use, it rises to> 200 objects, ~ 50% of the total. Continued use results in 100%. I have never heard of this before, but some googling indicate that it is used (among other things) when transferring data to and from the WCF level.
My current thought is that processes are created, but never released correctly. Our services are created from the Castle and registered from the website as:
public static IWindsorContainer RegisterWcfService<TS, TI>(this IWindsorContainer container)
where TI : TS
where TS : class
{
container.Register(Component.For<TS>().ImplementedBy<TI>().Named(typeof(TI).Name)
.Interceptors<LoggingInterceptor>()
.Interceptors<ExceptionHandlerInterceptor>()
.LifeStyle.Transient
.AsWcfService(
GetServiceModel<TS, TI>()
));
return container;
}
As suggested in other threads, we use
container.Kernel.ReleasePolicy = new NoTrackingReleasePolicy();
, . , , . - - , ?