Is "Out of Memory" a recoverable error?

Walter Bright newshound1 at
Thu Dec 4 10:30:18 PST 2008

Robert Jacques wrote:
> Okay, while we've been talking about OutOfMemoryError there's also 
> RangeError, AssertError, FinalizeError and SwitchError and not allowing 
> array indexing, contract programming or switches inside a nothrow 
> function drastically reduces their usefulness (more so than allocation, 
> in my opinion). So at least in debug mode, the handling frame (I think) 
> exists in order to support RangeError and AssertError errors. However, 
> SwitchError and HiddenFuncError occur in release code, so I'm not sure 
> if nothrow functions will not have some error handling method. (I think 
> FinalizeError is related to allocation and therefore OutOfMemoryError)

The idea behind Errors is that, even if you catch the exception, 
unwinding may not occur. Thus, your app should not be relying on 
destructors cleaning up properly. Catching an Error should only be used 
for doing things necessary before shutting down the app.

More information about the Digitalmars-d mailing list