[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [olpc-software] graceful handling of out-of-memory conditions
- From: Alan Cox <alan redhat com>
- To: msevior physics unimelb edu au
- Cc: olpc-software redhat com
- Subject: Re: [olpc-software] graceful handling of out-of-memory conditions
- Date: Tue, 28 Mar 2006 06:47:51 -0500
On Tue, Mar 28, 2006 at 09:33:37PM +1000, msevior physics unimelb edu au wrote:
> Instead we have code like:
>
> SomeClass * p = new SomeClass(...);
> p->SomeMethod(...);
>
> The original authors of AbiWord put in such checks but in practice we've
> never seen AbiWord fail this way so they have fallen out of favour.
std:set_new_handler(out_of_memory_func);
If I remember rightly C++ new failure throws "bad_alloc" as an exception
anyway nowdays rather than return NULL. (and no idea what occurs in this case
if you build with exceptions disabled). I guess the bad_alloc is closer to
what you need than a signal as its synchronous
> OK Once again my own ignorance shows. How can I find out what these are?
For C they are defined in the C language and POSIX/SuS specifications. Not
sure how it works for C++. See "info libc signal" and the Nonreentrancy node
for more info.
Alan
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]