Export (0) Print
Expand All

OutOfMemoryException Class

The exception that is thrown when there is not enough memory to continue the execution of a program.

For a list of all members of this type, see OutOfMemoryException Members.

System.Object
   System.Exception
      System.SystemException
         System.OutOfMemoryException

[Visual Basic]
<Serializable>
Public Class OutOfMemoryException
   Inherits SystemException
[C#]
[Serializable]
public class OutOfMemoryException : SystemException
[C++]
[Serializable]
public __gc class OutOfMemoryException : public SystemException
[JScript]
public
   Serializable
class OutOfMemoryException extends SystemException

Thread Safety

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

Remarks

The following Microsoft intermediate (MSIL) instructions throw OutOfMemoryException:

  • box
  • newarr
  • newobj

OutOfMemoryException uses the HRESULT COR_E_OUTOFMEMORY, which has the value 0x8007000E.

For a list of initial property values for an instance of OutOfMemoryException, see the OutOfMemoryException constructors.

.NET Compact Framework Platform Note:   The common language runtime can throw the exception when memory is not adequate to allocate for internal purposes or new managed objects. To avoid the exception, avoid programming large methods that consume 64 or more kilobytes of memory.

Requirements

Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

OutOfMemoryException Members | System Namespace | Exception | Handling and Throwing Exceptions

Show:
© 2014 Microsoft