System.Runtime.MemoryFailPoint.Dispose C# (CSharp) Method

Dispose() private method

private Dispose ( bool disposing ) : void
disposing bool
return void
        private void Dispose(bool disposing)
        {
            // This is just bookkeeping to ensure multiple threads can really
            // get enough memory, and this does not actually reserve memory
            // within the GC heap.
            if (_mustSubtractReservation) {
                RuntimeHelpers.PrepareConstrainedRegions();
                try {
                }
                finally {
                    SharedStatics.AddMemoryFailPointReservation(-((long)_reservedMemory));
                    _mustSubtractReservation = false;
                }
            }

            /*
            //                                   
            Interlocked.Add(ref LastKnownFreeAddressSpace, _reservedMemory);
            */
        }

Same methods

MemoryFailPoint::Dispose ( ) : void

Usage Example

 public static bool EnsureMemoryAvailability(int expectedSizeMegaBytes)
 {
     if (expectedSizeMegaBytes < 0)
     {
         throw new ArgumentException("Param expectedSizeBytes should be positive", "expectedSizeMegaBytes");
     }
     bool available = true;
     MemoryFailPoint p = null;
     try
     {
          p = new MemoryFailPoint(expectedSizeMegaBytes);
     }
     catch(InsufficientMemoryException)
     {
         available = false;
     }
     finally
     {
         if(p != null)
         {
             try { p.Dispose(); }
             catch(Exception)
             {
                 // ignored
             }
         }
     }
     return available;
 }
All Usage Examples Of System.Runtime.MemoryFailPoint::Dispose