C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
And: The system does not have this amount of RAM. So an InsufficientMemoryException is thrown.
ExceptionC# program that uses MemoryFailPoint
using System.Runtime;
class Program
{
static void Main()
{
// This program for some reason needs a huge amount of memory.
using (MemoryFailPoint point = new MemoryFailPoint(1000000))
{
// An exception is thrown at this point.
// ... The computer does not have enough memory.
// ... So we do not need to execute the inner code.
}
}
}
Output
Unhandled Exception: System.InsufficientMemoryException:
Insufficient memory to meet the expected demands of an operation,
and this system is likely to never satisfy this request.
If this is a 32 bit system, consider booting in 3 GB mode.
at System.Runtime.MemoryFailPoint..ctor(Int32 sizeInMegabytes)
at Program.Main()...