Is "Out of Memory" a recoverable error?

Sergey Gromov snake.scaly at gmail.com
Thu Dec 4 05:35:30 PST 2008


Tue, 02 Dec 2008 14:57:49 +0100, Don wrote:

> Walter Bright wrote:
>> I asked this over on stackoverflow.com to see what people using other 
>> languages have to say, as well as the D community. The reason I ask is 
>> to see if memory allocation can be allowed in functions marked "nothrow".
>> 
>> http://stackoverflow.com/questions/333736/is-out-of-memory-a-recoverable-error 
>> 
> I don't think it can be recoverable. Or rather, if it is recoverable, it 
> shouldn't have happened in the first place.
> 
> As far as I can tell, the only thing you could do to recover from an 
> out-of-memory condition is (1) to free some memory, or (2) to switch to 
> an algorithm which doesn't need as much memory.

or (3) to fail a self-contained, user initiated, "pure" operation.  Like
image loading process, or an expensive image editing operation, or a
complex calculation.  You'll find this sort of recovery in any
interactive data processing application.



More information about the Digitalmars-d mailing list