InsufficientMemoryException Class

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

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public sealed class InsufficientMemoryException : OutOfMemoryException
/** @attribute SerializableAttribute() */ 
public final class InsufficientMemoryException extends OutOfMemoryException
public final class InsufficientMemoryException extends OutOfMemoryException
Not applicable.

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 MemoryFailPoint 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 MemoryFailPoint class for a code example.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0