OutOfMemoryException Class
Collapse the table of content
Expand the table of content

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.


[Visual Basic]
Public Class OutOfMemoryException
   Inherits SystemException
public class OutOfMemoryException : SystemException
public __gc class OutOfMemoryException : public SystemException
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.


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.


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

© 2015 Microsoft