[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: error() or nil, 'error msg'
- From: Tim Hill <drtimhill@...>
- Date: Thu, 11 Sep 2014 18:36:24 -0700
On Sep 11, 2014, at 12:38 PM, Sean Conner <sean@conman.org> wrote:
>
> How would *you* handle ENOMEM?
>
> I wrote a big on this a few years ago:
>
> http://boston.conman.org/2009/12/01.2
>
imho ENOMEM (or getting NULL from malloc()) are pretty much an app panic. In our major apps we shim the malloc() family and then pre-allocate a block of memory. If the shim detects a malloc() failure it releases this block, puts the app in “clean but fast shutdown” mode, and then retries the malloc(). Even this is only really a last-ditch attempt to do a cleanup before we die.
—Tim
- References:
- error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Sean Conner
- Re: error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Sean Conner
- Re: error() or nil, 'error msg', William Ahern
- Re: error() or nil, 'error msg', Sean Conner