I have have an application that has MVC template and uses REST . Say I have a rest call made and it hits the particular method
void sample function() {
If garbage collection is the solution, a simple GC.Collect is often unsufficient and, for performance reason, it should only be called if really required. Try the following procedure that calls the garbage when the available memory is too low (below the threshold provided as procedure parameter).
internal static void CollectGarbage(int SizeToAllocateInMo)
{
long [,] TheArray ;
try { TheArray =new long[SizeToAllocateInMo,125000]; }low function
catch { TheArray=null ; GC.Collect() ; GC.WaitForPendingFinalizers() ; GC.Collect() ; }
TheArray=null ;
}