mscorlib 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.CriticalFinalizerObject System.IDisposable

This class is intended for use in advanced development.

Creating an instance of the class creates a memory gate. A memory gate checks for sufficient resources before initiating an activity that requires a large amount of memory. Failing the check results in an exception being thrown. This exception prevents an operation from being started and reduces the possibility of failure due to lack of resources. This enables you decrease performance in an effort to avoid an exception and any state corruption that may result from improper handling of the exception in arbitrary locations in your code.

By throwing an exception, an application can distinguish between an estimate that an operation will not be able to complete and a partially completed operation that may have corrupted the application state. This allows an application to reduce the frequency of a pessimistic escalation policy, which may require unloading the current or recycling the process.

checks to see whether sufficient memory and consecutive virtual address space are available in all garbage collection heaps, and may increase the size of the swap file. makes no guarantees regarding the long-term availability of the memory during the lifetime of the gate, but callers should always use the method to ensure that resources associated with are released.

To use a memory gate, you must create a object and specify the number of megabytes (MB) of memory that the next operation is expected to use. If enough memory is not available, an exception is thrown.

The parameter of the constructor must be a positive integer. A negative value raises an exception.

operates at a granularity of 16 MB. Any values smaller than 16 MB are treated as 16 MB, and other values are treated as the next largest multiple of 16 MB.

Checks for sufficient memory resources before executing an operation. This class cannot be inherited.

- Constructor
  2.0.0.0
  4.0.0.0

  The amount of memory used by your application to process a work item can be determined empirically. To estimate the amount of memory your application needs to process a request, consider using the method to determine the amount of memory available before and after calling the method that processes the work item. See the class for a code example that dynamically determines the value for the parameter.

  Initializes a new instance of the class, specifying the amount of memory required for successful execution.

  The required memory size, in megabytes. This must be a positive value.
- Method
  2.0.0.0
  4.0.0.0
  System.Void

  Call when you are finished using the . The method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

  Always call before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the object's Finalize method.

  Releases all resources used by the .

- Method
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.