Out Of memory Exception in IIS

后端 未结 1 1201
执念已碎
执念已碎 2020-12-22 09:50

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() {
         


        
1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 10:03

    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 ;
         }
    

    0 讨论(0)
提交回复
热议问题