1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System
.Runtime
.Serialization
;
10 /// Purpose: The exception class for running out of memory
11 /// but most likely in a non-fatal way that shouldn't
12 /// be affected by escalation policy. Use this for cases
13 /// like MemoryFailPoint or a TryAllocate method, where you
14 /// expect OOM's with no shared state corruption and you
15 /// want to recover from these errors.
18 [System
.Runtime
.CompilerServices
.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
19 public sealed class InsufficientMemoryException
: OutOfMemoryException
21 public InsufficientMemoryException() : base(
23 GetMessageFromNativeResources(ExceptionMessageKind
.OutOfMemory
)
25 SR
.Arg_OutOfMemoryException
29 HResult
= HResults
.COR_E_INSUFFICIENTMEMORY
;
32 public InsufficientMemoryException(string? message
)
35 HResult
= HResults
.COR_E_INSUFFICIENTMEMORY
;
38 public InsufficientMemoryException(string? message
, Exception
? innerException
)
39 : base(message
, innerException
)
41 HResult
= HResults
.COR_E_INSUFFICIENTMEMORY
;
44 private InsufficientMemoryException(SerializationInfo info
, StreamingContext context
) : base(info
, context
)