A new application that has been developed has a heavy use of web services. We started hitting out of memory exceptions on a regular basis (as usage has increased). Upon reviewing the memory dumps I noticed there were a large number of same sized byte[]. Looking at the handles for these byte[] I noticed that they were referenced by System.Security.Policy.Evidence
Upon further review I identified these memory allocations as the actual assemblies (dlls) that had our web service classes in them (2 of the assemblies in particular were in memory 128 times and 115 times). I found some information in here --> blogs.msdn.com/tess/archive/2008/06/25/asp-net-memory-leak-byte-arrays-rooted-in-system-security-policy-evidence.aspx
and here --> blogs.javista.com/2009/03/18/best-practices-for-crm-memory-usage/
but I have not been able to find much other reference to this issue. (.NET framework loading the webservice assembly into memory to check security policys).
Currently, one of the only solutions I am seeing is to seperate the asseblies of the webservices into smaller assemblies that reference libraries.
I am confused why the .NET framework must load the entire assembly into memory to check the policies and wanted to see if anyone else has encountered this and what your solutions were.
Thanks, Dan