Is EOutOfMemory exception recoverable?

delphi, exception, out-of-memory

Solution

In my opinion, there's no point attempting to continue from `EOutOfMemory`. In my experience, chances are exceedingly high that the heap will be corrupted and future errors can be expected. Usually, the safest course of action is to terminate the process.

Problem

Does it make sense to continue execution after catching `EOutOfMemory` exception or now heap or stack is corrupted with a high probability? I don't mean the case of `EOutOfMemory` caused by previous memory corruption due to bugs like writing to a wild address, I mean correct code that calls `GetMem` and catches `EOutOfMemory`.

Original source