System.InsufficientMemoryException Class

The exception that is thrown when a check for sufficient available memory fails. This class cannot be inherited.

See Also: InsufficientMemoryException Members


public sealed class InsufficientMemoryException : OutOfMemoryException


Unlike OutOfMemoryException, InsufficientMemoryException is thrown before starting an operation, and thus does not imply state corruption. An application can catch this exception, throttle back its memory usage, and avoid actual out of memory conditions and their potential for corrupting program state.

This exception is thrown by the System.Runtime.MemoryFailPoint.#ctor(int) constructor when you specify a projected memory allocation larger than the amount of currently available memory. Your program can catch the exception and either delay the task that needs the memory or execute it in smaller steps that require less memory.

See the System.Runtime.MemoryFailPoint class for a code example.


This exception is not included in the tp:// or the Portable Class Library, but it is thrown by some members that are. To catch the exception in that case, write a catch statement for OutOfMemoryException instead.


Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0